summary refs log tree commit diff
path: root/nixos/modules/services/mail
diff options
context:
space:
mode:
authorSarah Brofeldt <sbrofeldt@gmail.com>2017-11-01 19:06:27 +0100
committerJoachim Schiele <js@lastlog.de>2017-11-01 19:06:27 +0100
commit2ddcdcce2652016ac58826fa600d19db111178e5 (patch)
treec25cb6fd1e93f1cff3baee7423ffd0c11292d084 /nixos/modules/services/mail
parente1cd08e1c7bba15084d067ca6d321166e70012a4 (diff)
downloadnixlib-2ddcdcce2652016ac58826fa600d19db111178e5.tar
nixlib-2ddcdcce2652016ac58826fa600d19db111178e5.tar.gz
nixlib-2ddcdcce2652016ac58826fa600d19db111178e5.tar.bz2
nixlib-2ddcdcce2652016ac58826fa600d19db111178e5.tar.lz
nixlib-2ddcdcce2652016ac58826fa600d19db111178e5.tar.xz
nixlib-2ddcdcce2652016ac58826fa600d19db111178e5.tar.zst
nixlib-2ddcdcce2652016ac58826fa600d19db111178e5.zip
nixos/postfix: support alternate smtp ports when relaying (#30685)
* postfix: support alternate smtp ports when relaying

* fix missing ; after merge
Diffstat (limited to 'nixos/modules/services/mail')
-rw-r--r--nixos/modules/services/mail/postfix.nix19
1 files changed, 8 insertions, 11 deletions
diff --git a/nixos/modules/services/mail/postfix.nix b/nixos/modules/services/mail/postfix.nix
index 1fef9ac6ec90..867c0ea6761c 100644
--- a/nixos/modules/services/mail/postfix.nix
+++ b/nixos/modules/services/mail/postfix.nix
@@ -60,11 +60,11 @@ let
     manpage_directory    = "${pkgs.postfix}/share/man";
     html_directory       = "${pkgs.postfix}/share/postfix/doc/html";
     shlib_directory      = false;
-    relayhost            = if cfg.lookupMX || cfg.relayHost == ""
-                             then cfg.relayHost
-                             else
-			       "[${cfg.relayHost}]"
-			       + optionalString (cfg.relayPort != null) ":${toString cfg.relayPort}";
+    relayhost            = if cfg.relayHost == "" then "" else
+                             if cfg.lookupMX
+                             then "${cfg.relayHost}:${toString cfg.relayPort}"
+                             else "[${cfg.relayHost}]:${toString cfg.relayPort}";
+
     mail_spool_directory = "/var/spool/mail/";
     setgid_group         = setgidGroup;
   }
@@ -461,13 +461,10 @@ in
       };
 
       relayPort = mkOption {
-        type = types.nullOr types.int;
-        default = null;
-        example = 587;
+        type = types.int;
+        default = 25;
         description = "
-          Specify an optional port for outbound mail relay. (Note:
-          only used if an explicit <option>relayHost</option> is
-          defined.)
+          SMTP port for relay mail relay.
         ";
       };