Skip to content

Commit

Permalink
Reload postfix-setup when mailing list membership changes
Browse files Browse the repository at this point in the history
This fixes #505
  • Loading branch information
jfly committed Nov 8, 2024
1 parent 71f6fc1 commit 4833095
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 13 additions & 8 deletions non-critical-infra/modules/mailserver/mailing-lists.nix
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,19 @@ in
}) secretFiles
);

# Whenever this changes, we need to manually restart the `postfix-setup`
# service for postfix to notice the change.
# TODO: <https://github.com/NixOS/infra/issues/505> tracks fixing this
sops.templates."postfix-virtual-mailing-lists".content = lib.concatStringsSep "\n" (
lib.mapAttrsToList (
name: members: "${name} ${lib.concatStringsSep ", " members}"
) listsWithSecretPlaceholders
);
sops.templates."postfix-virtual-mailing-lists" = {
content = lib.concatStringsSep "\n" (
lib.mapAttrsToList (
name: members: "${name} ${lib.concatStringsSep ", " members}"
) listsWithSecretPlaceholders
);

# Need to restart postfix-setup to rerun `postmap` and generate updated `.db`
# files whenever mailing list membership changes.
# This could go away if sops-nix gets support for "input addressed secret
# paths": https://github.com/Mic92/sops-nix/issues/648
restartUnits = [ "postfix-setup.service" ];
};

services.postfix.mapFiles.virtual-mailing-lists =
config.sops.templates."postfix-virtual-mailing-lists".path;
Expand Down

0 comments on commit 4833095

Please sign in to comment.