Make submission options more flexible

uwap cc658b69 d1e4ee14

+10 -10
+10 -10
nixos/modules/services/mail/postfix.nix
··· 129 129 smtp inet n - n - - smtpd 130 130 '' + optionalString cfg.enableSubmission '' 131 131 submission inet n - n - - smtpd 132 - -o smtpd_tls_security_level=encrypt 133 - -o smtpd_sasl_auth_enable=yes 134 - -o smtpd_client_restrictions=permit_sasl_authenticated,reject 135 - ${cfg.extraSubmissionOptions} 132 + ${concatStringsSep "\n " (mapAttrsToList (x: y: "-o " + x + "=" + y) cfg.submissionOptions)} 136 133 '' 137 134 + '' 138 135 pickup unix n - n 60 1 pickup ··· 208 205 enableSubmission = mkOption { 209 206 type = types.bool; 210 207 default = false; 211 - description = "Whether to enable smtp submission in master.cf."; 208 + description = "Whether to enable smtp submission"; 212 209 }; 213 210 214 - extraSubmissionOptions = mkOption { 215 - type = types.str; 216 - default = ""; 217 - description = "Extra options for the submission config in master.cf."; 218 - example = "-o milter_macro_daemon_name=ORIGINATING"; 211 + submissionOptions = mkOption { 212 + type = types.attrs; 213 + default = { "smtpd_tls_security_level" = "encrypt"; 214 + "smtpd_sasl_auth_enable" = "yes"; 215 + "smtpd_client_restrictions" = "permit_sasl_authenticated,reject"; 216 + }; 217 + description = "Options for the submission config in master.cf"; 218 + example = { "milter_macro_daemon_name" = "ORIGINATING"; }; 219 219 }; 220 220 221 221 setSendmail = mkOption {