]> git.immae.eu Git - perso/Immae/Config/Nix.git/commitdiff
Add libspf2 flake package
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Sat, 2 Jan 2021 00:47:43 +0000 (01:47 +0100)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Sat, 2 Jan 2021 00:48:29 +0000 (01:48 +0100)
flakes/libspf2/flake.lock [new file with mode: 0644]
flakes/libspf2/flake.nix [new file with mode: 0644]
flakes/openarc/flake.nix

diff --git a/flakes/libspf2/flake.lock b/flakes/libspf2/flake.lock
new file mode 100644 (file)
index 0000000..a278bc0
--- /dev/null
@@ -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 (file)
index 0000000..276b138
--- /dev/null
@@ -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;
+    }
+  );
+}
index 9bc104dd7b28a39fa9b46625d5d362f72097b05c..e2b771affef9be50083c300b90df02a5617b757c 100644 (file)
@@ -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