summary refs log tree commit diff
path: root/nixos/modules/services/mail
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/modules/services/mail')
-rw-r--r--nixos/modules/services/mail/postfix.nix15
1 files changed, 14 insertions, 1 deletions
diff --git a/nixos/modules/services/mail/postfix.nix b/nixos/modules/services/mail/postfix.nix
index 2185484827de..1fef9ac6ec90 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 <option>relayHost</option> is
+          defined.)
+        ";
+      };
+
       lookupMX = mkOption {
         type = types.bool;
         default = false;