nixos/mailman: decouple the mailman module from the postfix module

https://github.com/NixOS/nixpkgs/pull/67708#discussion_r319579987 suggested
that simply appending the necessary maps to the appropriate attributes in
services.postfix.config gets the job done; we don't special support in the
postfix module to accomplish that.
This commit is contained in:
Peter Simons 2019-08-30 18:42:28 +02:00
parent d20d6034bd
commit eedf3dc6e2
2 changed files with 13 additions and 9 deletions

View File

@ -83,10 +83,15 @@ in {
etc."mailman.cfg".text = mailmanCfg;
};
services.postfix.config = {
services.postfix = {
relayDomains = [ "hash:/var/lib/mailman/data/postfix_domains" ];
config = {
transport_maps = [ "hash:/var/lib/mailman/data/postfix_lmtp" ];
local_recipient_maps = [ "hash:/var/lib/mailman/data/postfix_lmtp" ];
# Mailman uses recipient delimiters, so we don't need special handling.
owner_request_special = "no";
};
};
systemd.services.mailman = {
description = "GNU Mailman Master Process";

View File

@ -11,10 +11,9 @@ let
haveAliases = cfg.postmasterAlias != "" || cfg.rootAlias != ""
|| cfg.extraAliases != "";
haveTransport = cfg.transport != "" || config.services.mailman.enable;
haveTransport = cfg.transport != "";
haveVirtual = cfg.virtual != "";
haveLocalRecipients = cfg.localRecipients != null || config.services.mailman.enable;
haveRelayDomains = cfg.relayDomains != null || config.services.mailman.enable;
haveLocalRecipients = cfg.localRecipients != null;
clientAccess =
optional (cfg.dnsBlacklistOverrides != "")
@ -753,12 +752,12 @@ in
// optionalAttrs (cfg.domain != "") { mydomain = cfg.domain; }
// optionalAttrs (cfg.origin != "") { myorigin = cfg.origin; }
// optionalAttrs (cfg.destination != null) { mydestination = cfg.destination; }
// optionalAttrs haveRelayDomains { relay_domains = optionals (cfg.relayDomains != null) cfg.relayDomains ++ optional config.services.mailman.enable "hash:/var/lib/mailman/data/postfix_domains"; }
// optionalAttrs (cfg.relayDomains != null) { relay_domains = cfg.relayDomains; }
// optionalAttrs (cfg.recipientDelimiter != "") { recipient_delimiter = cfg.recipientDelimiter; }
// optionalAttrs haveAliases { alias_maps = [ "${cfg.aliasMapType}:/etc/postfix/aliases" ]; }
// optionalAttrs haveTransport { transport_maps = [ "hash:/etc/postfix/transport" ] ++ optional config.services.mailman.enable "hash:/var/lib/mailman/data/postfix_lmtp"; }
// optionalAttrs haveTransport { transport_maps = [ "hash:/etc/postfix/transport" ]; }
// optionalAttrs haveVirtual { virtual_alias_maps = [ "${cfg.virtualMapType}:/etc/postfix/virtual" ]; }
// optionalAttrs haveLocalRecipients { local_recipient_maps = [ "hash:/etc/postfix/local_recipients" ] ++ optional haveAliases "$alias_maps" ++ optional config.services.mailman.enable "hash:/var/lib/mailman/data/postfix_lmtp"; }
// optionalAttrs haveLocalRecipients { local_recipient_maps = [ "hash:/etc/postfix/local_recipients" ] ++ optional haveAliases "$alias_maps"; }
// optionalAttrs (cfg.dnsBlacklists != []) { smtpd_client_restrictions = clientRestrictions; }
// optionalAttrs cfg.useSrs {
sender_canonical_maps = [ "tcp:127.0.0.1:10001" ];