diff --git a/nixos/modules/services/mail/postfix.nix b/nixos/modules/services/mail/postfix.nix index 2185484827d..1fef9ac6ec9 100644 --- a/nixos/modules/services/mail/postfix.nix +++ b/nixos/modules/services/mail/postfix.nix @@ -62,7 +62,9 @@ let shlib_directory = false; relayhost = if cfg.lookupMX || cfg.relayHost == "" then cfg.relayHost - else "[${cfg.relayHost}]"; + else + "[${cfg.relayHost}]" + + optionalString (cfg.relayPort != null) ":${toString cfg.relayPort}"; mail_spool_directory = "/var/spool/mail/"; setgid_group = setgidGroup; } @@ -458,6 +460,17 @@ in "; }; + relayPort = mkOption { + type = types.nullOr types.int; + default = null; + example = 587; + description = " + Specify an optional port for outbound mail relay. (Note: + only used if an explicit is + defined.) + "; + }; + lookupMX = mkOption { type = types.bool; default = false;