3 path = "../../opendmarc";
6 inputs.files-watcher = {
7 path = "../../files-watcher";
14 inputs.nix-lib.url = "github:NixOS/nixpkgs";
16 description = "Private configuration for opendmarc";
17 outputs = { self, nix-lib, opendmarc, my-lib, files-watcher }:
19 cfg = name': { config, lib, pkgs, name, ... }: {
21 (my-lib.lib.withNarKey files-watcher "nixosModule")
22 (my-lib.lib.withNarKey opendmarc "nixosModule")
24 #(my-lib.lib.withNarKey secrets "nixosModule")
26 config = lib.mkIf (name == name') {
27 users.users."${config.services.opendmarc.user}".extraGroups = [ "keys" ];
28 systemd.services.opendmarc.serviceConfig.Slice = "mail.slice";
29 services.opendmarc = {
31 socket = "/run/opendmarc/opendmarc.sock";
32 configFile = pkgs.writeText "opendmarc.conf" ''
35 FailureReportsBcc postmaster@immae.eu
36 FailureReportsOnNone true
37 FailureReportsSentBy postmaster@immae.eu
38 IgnoreAuthenticatedClients true
39 IgnoreHosts ${config.secrets.fullPaths."opendmarc/ignore.hosts"}
45 group = config.services.postfix.group;
47 services.filesWatcher.opendmarc = {
50 config.secrets.fullPaths."opendmarc/ignore.hosts"
55 dest = "opendmarc/ignore.hosts";
56 user = config.services.opendmarc.user;
57 group = config.services.opendmarc.group;
60 mxes = lib.attrsets.filterAttrs
64 builtins.concatStringsSep "\n" ([
65 config.myEnv.mail.dmarc.ignore_hosts
66 ] ++ lib.mapAttrsToList (n: v: v.fqdn) mxes);
73 { nixosModules = opendmarc.nixosModules or {} // nix-lib.lib.genAttrs ["eldiron" "backup-2"] cfg; };