@cryptotaxi247 / infra-1 / commits / 4833095f

Reload `postfix-setup` when mailing list membership changes

This fixes https://github.com/NixOS/infra/issues/505

Jeremy Fleischman committed Nov 8, 2024 at 09:43 UTC 4833095f9c6ebe495a8c79ebe2dbf027332745c1
2 files changed +16 -11
flake.lock
+3 -3
@@ -370,11 +370,11 @@
370 ]
371 },
372 "locked": {
373 - "lastModified": 1730605784,
374 - "narHash": "sha256-1NveNAMLHbxOg0BpBMSVuZ2yW2PpDnZLbZ25wV50PMc=",
373 + "lastModified": 1731047660,
374 + "narHash": "sha256-iyp51lPWEQz4c5VH9bVbAuBcFP4crETU2QJYh5V0NYA=",
375 "owner": "Mic92",
376 "repo": "sops-nix",
377 - "rev": "e9b5eef9b51cdf966c76143e13a9476725b2f760",
377 + "rev": "60e1bce1999f126e3b16ef45f89f72f0c3f8d16f",
378 "type": "github"
379 },
380 "original": {
non-critical-infra/modules/mailserver/mailing-lists.nix
+13 -8
@@ -48,14 +48,19 @@ in
48 }) secretFiles
49 );
50
51 - # Whenever this changes, we need to manually restart the `postfix-setup`
52 - # service for postfix to notice the change.
53 - # TODO: <https://github.com/NixOS/infra/issues/505> tracks fixing this
54 - sops.templates."postfix-virtual-mailing-lists".content = lib.concatStringsSep "\n" (
55 - lib.mapAttrsToList (
56 - name: members: "${name} ${lib.concatStringsSep ", " members}"
57 - ) listsWithSecretPlaceholders
58 - );
51 + sops.templates."postfix-virtual-mailing-lists" = {
52 + content = lib.concatStringsSep "\n" (
53 + lib.mapAttrsToList (
54 + name: members: "${name} ${lib.concatStringsSep ", " members}"
55 + ) listsWithSecretPlaceholders
56 + );
57 +
58 + # Need to restart postfix-setup to rerun `postmap` and generate updated `.db`
59 + # files whenever mailing list membership changes.
60 + # This could go away if sops-nix gets support for "input addressed secret
61 + # paths": https://github.com/Mic92/sops-nix/issues/648
62 + restartUnits = [ "postfix-setup.service" ];
63 + };
64
65 services.postfix.mapFiles.virtual-mailing-lists =
66 config.sops.templates."postfix-virtual-mailing-lists".path;