Skip to content

Commit

Permalink
Merge pull request #506 from jfly/issue-505-reload-postfix
Browse files Browse the repository at this point in the history
Reload `postfix-setup` when mailing list membership changes
  • Loading branch information
Mic92 authored Nov 9, 2024
2 parents d870921 + 4833095 commit f966083
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 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.

4 changes: 1 addition & 3 deletions macs/nix-darwin.nix
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ in
};

nix.package = pkgs.nixVersions.nix_2_24.overrideAttrs (oldAttrs: {
patches = oldAttrs.patches or [ ] ++ [
./disable-chroot.patch
];
patches = oldAttrs.patches or [ ] ++ [ ./disable-chroot.patch ];
});
nix.gc.automatic = true;
nix.gc.user = "";
Expand Down
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 f966083

Please sign in to comment.