git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #12155 from vkleen/postfix-configuration-options

Postfix configuration options

commitf4b2c3d51001aeef107bf33ba065d322e2c243c5 authorPeter Simons <simons@cryp.to> dateTue 5 Jan 2016, 12:32 (11 years ago) parentbab578febd8e2c
1 file changed+21
nixos/modules/services/mail/postfix.nix+21
nixos/modules/services/mail/postfix.nix+21
@@ -83,6 +83,9 @@ let
8383 + optionalString (cfg.virtual != "") ''
8484 virtual_alias_maps = hash:/etc/postfix/virtual
8585 ''
86+ + optionalString (cfg.transport != "") ''
87+ transport_maps = hash:/etc/postfix/transport
88+ ''
8689 + cfg.extraConfig;
8790
8891 masterCf = ''
@@ -108,10 +111,14 @@ let
108111 flush unix n - n 1000? 0 flush
109112 proxymap unix - - n - - proxymap
110113 proxywrite unix - - n - 1 proxymap
114+ ''
115+ + optionalString cfg.enableSmtp ''
111116 smtp unix - - n - - smtp
112117 relay unix - - n - - smtp
113118 -o smtp_fallback_relay=
114119 # -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
120+ ''
121+ + ''
115122 showq unix n - n - - showq
116123 error unix - - n - - error
117124 retry unix - - n - - error
@@ -138,6 +145,7 @@ let
138145 virtualFile = pkgs.writeText "postfix-virtual" cfg.virtual;
139146 mainCfFile = pkgs.writeText "postfix-main.cf" mainCf;
140147 masterCfFile = pkgs.writeText "postfix-master.cf" masterCf;
148+ transportFile = pkgs.writeText "postfix-transport" cfg.transport;
141149
142150in
143151
@@ -154,6 +162,11 @@ in
154162 description = "Whether to run the Postfix mail server.";
155163 };
156164
165+ enableSmtp = mkOption {
166+ default = true;
167+ description = "Whether to enable smtp in master.cf.";
168+ };
169+
157170 setSendmail = mkOption {
158171 default = true;
159172 description = "Whether to set the system sendmail to postfix's.";
@@ -305,6 +318,13 @@ in
305318 ";
306319 };
307320
321+ transport = mkOption {
322+ default = "";
323+ description = "
324+ Entries for the transport map, cf. man-page transport(8).
325+ ";
326+ };
327+
308328 extraMasterConf = mkOption {
309329 default = "";
310330 example = "submission inet n - n - - smtpd";
@@ -383,6 +403,7 @@ in
383403 ln -sf ${virtualFile} /var/postfix/conf/virtual
384404 ln -sf ${mainCfFile} /var/postfix/conf/main.cf
385405 ln -sf ${masterCfFile} /var/postfix/conf/master.cf
406+ ln -sf ${transportFile} /var/postfix/conf/transport
386407
387408 ${pkgs.postfix}/sbin/postalias -c /var/postfix/conf /var/postfix/conf/aliases
388409 ${pkgs.postfix}/sbin/postmap -c /var/postfix/conf /var/postfix/conf/virtual