]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - flakes/opendmarc/flake.nix
Add monitoring script with smartctl
[perso/Immae/Config/Nix.git] / flakes / opendmarc / flake.nix
index bf7bd5bc714f1680e11763ebde4d280060d19bee..70b8cd7171a11069a734ecb1875e916d8a8e60fd 100644 (file)
@@ -2,22 +2,14 @@
   description = "Open source ARC implementation";
 
   inputs.myuids = {
-    url = "https://git.immae.eu/perso/Immae/Config/Nix.git";
-    type = "git";
-    dir = "flakes/myuids";
-  };
-  inputs.libspf2 = {
-    url = "https://git.immae.eu/perso/Immae/Config/Nix.git";
-    type = "git";
-    dir = "flakes/libspf2";
-    inputs.nixpkgs.follows = "nixpkgs";
+    url = "path:../myuids";
   };
   inputs.flake-utils.url = "github:numtide/flake-utils";
   inputs.nixpkgs.url = "github:NixOS/nixpkgs";
 
-  outputs = { self, myuids, libspf2, flake-utils, nixpkgs }: flake-utils.lib.eachSystem ["aarch64-linux" "i686-linux" "x86_64-linux"] (system:
+  outputs = { self, myuids, flake-utils, nixpkgs }: flake-utils.lib.eachSystem ["aarch64-linux" "i686-linux" "x86_64-linux"] (system:
     let
-      pkgs = import nixpkgs { inherit system; overlays = [ libspf2.overlay ]; };
+      pkgs = import nixpkgs { inherit system; overlays = []; };
     in rec {
       packages.opendmarc = pkgs.callPackage ./. {};
       defaultPackage = packages.opendmarc;
      nixosModule = { config, lib, pkgs, ... }:
        let
          cfg = config.services.opendmarc;
-         defaultSock = "local:/run/opendmarc/opendmarc.sock";
-         args = [ "-f" "-l" "-p" cfg.socket ] ++ lib.optionals (cfg.configFile != null) [ "-c" cfg.configFile ];
+         defaultSock = "/run/opendmarc/opendmarc.sock";
+         args = [ "-f" "-l" "-p" "local:${cfg.socket}" ] ++ lib.optionals (cfg.configFile != null) [ "-c" cfg.configFile ];
        in {
-         options = {
+        # Necessary for situations where flake gets included multiple times
+        key = builtins.hashString "sha256" (builtins.path { path = self.sourceInfo.outPath; name = "source"; });
+        options = {
            services.opendmarc = {
              enable = lib.mkOption {
                type = lib.types.bool;
@@ -93,6 +87,7 @@
          };
 
          config = lib.mkIf cfg.enable {
+           nixpkgs.overlays = [ self.overlay ];
            users.users = lib.optionalAttrs (cfg.user == "opendmarc") {
              opendmarc = {
                group = cfg.group;
              opendmarc.gid = myuids.lib.gids.opendmarc;
            };
 
-           environment.systemPackages = [ self.defaultPackage."${pkgs.system}" ];
+           environment.systemPackages = [ pkgs.opendmarc ];
 
            systemd.services.opendmarc = {
              description = "OpenDMARC daemon";