From 749623765bef80615fc21e73aff89521d262e277 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Isma=C3=ABl=20Bouya?= Date: Sat, 2 Jan 2021 01:47:43 +0100 Subject: [PATCH] Add libspf2 flake package --- flakes/libspf2/flake.lock | 42 ++++++++++++++++++++++++++++++ flakes/libspf2/flake.nix | 54 +++++++++++++++++++++++++++++++++++++++ flakes/openarc/flake.nix | 2 +- 3 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 flakes/libspf2/flake.lock create mode 100644 flakes/libspf2/flake.nix diff --git a/flakes/libspf2/flake.lock b/flakes/libspf2/flake.lock new file mode 100644 index 0000000..a278bc0 --- /dev/null +++ b/flakes/libspf2/flake.lock @@ -0,0 +1,42 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1609246779, + "narHash": "sha256-eq6ZXE/VWo3EMC65jmIT6H/rrUc9UWOWVujkzav025k=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "08c7ad4a0844adc4a7f9f5bb3beae482e789afa4", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1597943282, + "narHash": "sha256-G/VQBlqO7YeFOSvn29RqdvABZxmQBtiRYVA6kjqWZ6o=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "c59ea8b8a0e7f927e7291c14ea6cd1bd3a16ff38", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flakes/libspf2/flake.nix b/flakes/libspf2/flake.nix new file mode 100644 index 0000000..276b138 --- /dev/null +++ b/flakes/libspf2/flake.nix @@ -0,0 +1,54 @@ +{ + description = "Sender Policy Framework record checking library"; + + inputs.flake-utils.url = "github:numtide/flake-utils"; + inputs.nixpkgs.url = "github:NixOS/nixpkgs"; + + outputs = { self, flake-utils, nixpkgs }: flake-utils.lib.eachSystem ["aarch64-linux" "i686-linux" "x86_64-linux"] (system: + let + pkgs = import nixpkgs { inherit system; overlays = []; }; + inherit (pkgs) stdenv file fetchurl fetchpatch libnsl; + in rec { + packages.libspf2 = stdenv.mkDerivation rec { + pname = "libspf2"; + version = "1.2.10"; + + patches = [ + (fetchpatch { + name = "fix-variadic-macros.patch"; + url = "https://git.archlinux.org/svntogit/community.git/plain/trunk/fix-variadic-macros.patch?h=packages/libspf2"; + sha256 = "00dqpcgjr9jy2qprgqv2qiyvq8y3wlz4yns9xzabf2064jzqh2ic"; + }) + ]; + preConfigure = '' + sed -i -e "s@/usr/bin/file@${file}/bin/file@" ./configure + ''; + configureFlags = [ + "--enable-static" + ]; + postInstall = '' + rm $out/bin/*_static + ''; + src = fetchurl { + url = "https://www.libspf2.org/spf/${pname}-${version}.tar.gz"; + sha256 = "1j91p0qiipzf89qxq4m1wqhdf01hpn1h5xj4djbs51z23bl3s7nr"; + }; + + buildInputs = [ libnsl ]; + + meta = { + description = "Sender Policy Framework record checking library"; + homepage = "https://www.libspf2.org/"; + platforms = stdenv.lib.platforms.linux; + }; + }; + + defaultPackage = packages.libspf2; + legacyPackages.libfspf2 = packages.libspf2; + apps.libspf2 = flake-utils.lib.mkApp { drv = packages.libspf2; name = "spfquery"; }; + defaultApp = apps.libspf2; + checks.build = defaultPackage; + hydraJobs.build = packages.libspf2; + } + ); +} diff --git a/flakes/openarc/flake.nix b/flakes/openarc/flake.nix index 9bc104d..e2b771a 100644 --- a/flakes/openarc/flake.nix +++ b/flakes/openarc/flake.nix @@ -43,6 +43,7 @@ legacyPackages.openarc = packages.openarc; apps.openarc = flake-utils.lib.mkApp { drv = packages.openarc; }; defaultApp = apps.openarc; + hydraJobs = checks; checks = { build = defaultPackage; } // pkgs.lib.optionalAttrs (builtins.elem system pkgs.lib.systems.doubles.linux) { @@ -74,7 +75,6 @@ }; }; }) // { - hydraJobs.build = nixpkgs.lib.genAttrs flake-utils.lib.defaultSystems (system: self.defaultPackage."${system}"); nixosModules = (if builtins.pathExists ./private.nix then import ./private.nix nixpkgs else {}); nixosModule = { config, lib, pkgs, ... }: let -- 2.41.0