]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - flakes/private/opendmarc/flake.nix
Remove manual packages for fluentd / fluentbit
[perso/Immae/Config/Nix.git] / flakes / private / opendmarc / flake.nix
index 9aeb3dba9b04e09f9d6ff45424d2f7cfb12f40dc..7e9e8eb4d5ea117eee2710c0ba94e502ea67af6b 100644 (file)
@@ -1,20 +1,25 @@
 {
-  inputs.opendmarc = {
-    url = "https://git.immae.eu/perso/Immae/Config/Nix.git";
-    type = "git";
-    dir = "flakes/opendmarc";
-  };
-  inputs.nixpkgs.url = "github:NixOS/nixpkgs";
+  inputs.opendmarc.url = "path:../../opendmarc";
+  inputs.environment.url = "path:../environment";
+  inputs.secrets.url = "path:../../secrets";
+  inputs.files-watcher.url = "path:../../files-watcher";
 
   description = "Private configuration for opendmarc";
-  outputs = { self, nixpkgs, opendmarc }:
-    let
-      cfg = name': { config, lib, pkgs, name, ... }: lib.mkIf (name == name') {
+  outputs = { self, environment, opendmarc, files-watcher, secrets }: {
+    nixosModule = self.nixosModules.opendmarc;
+    nixosModules.opendmarc = { config, lib, pkgs, ... }: {
+      imports = [
+        environment.nixosModule
+        files-watcher.nixosModule
+        opendmarc.nixosModule
+        secrets.nixosModule
+      ];
+      config = {
         users.users."${config.services.opendmarc.user}".extraGroups = [ "keys" ];
         systemd.services.opendmarc.serviceConfig.Slice = "mail.slice";
         services.opendmarc = {
           enable = true;
-          socket = "local:${config.myServices.mail.milters.sockets.opendmarc}";
+          socket = "/run/opendmarc/opendmarc.sock";
           configFile = pkgs.writeText "opendmarc.conf" ''
             AuthservID                  HOSTNAME
             FailureReports              false
@@ -36,9 +41,8 @@
             config.secrets.fullPaths."opendmarc/ignore.hosts"
           ];
         };
-        secrets.keys = [
-          {
-            dest = "opendmarc/ignore.hosts";
+        secrets.keys = {
+          "opendmarc/ignore.hosts" = {
             user = config.services.opendmarc.user;
             group = config.services.opendmarc.group;
             permissions = "0400";
                 builtins.concatStringsSep "\n" ([
                   config.myEnv.mail.dmarc.ignore_hosts
                 ] ++ lib.mapAttrsToList (n: v: v.fqdn) mxes);
-          }
-        ];
+          };
+        };
       };
-    in
-      opendmarc.outputs //
-      { nixosModules = opendmarc.nixosModules or {} // nixpkgs.lib.genAttrs ["eldiron" "backup-2"] cfg; };
+    };
+  };
 }
-