From cc658b695a2d6a49f9c94f0ac9d124de1f62b644 Mon Sep 17 00:00:00 2001 From: uwap Date: Thu, 9 Jun 2016 18:06:07 +0200 Subject: [PATCH] Make submission options more flexible --- nixos/modules/services/mail/postfix.nix | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/nixos/modules/services/mail/postfix.nix b/nixos/modules/services/mail/postfix.nix index e354ae66819..616018fc307 100644 --- a/nixos/modules/services/mail/postfix.nix +++ b/nixos/modules/services/mail/postfix.nix @@ -129,10 +129,7 @@ let smtp inet n - n - - smtpd '' + optionalString cfg.enableSubmission '' submission inet n - n - - smtpd - -o smtpd_tls_security_level=encrypt - -o smtpd_sasl_auth_enable=yes - -o smtpd_client_restrictions=permit_sasl_authenticated,reject - ${cfg.extraSubmissionOptions} + ${concatStringsSep "\n " (mapAttrsToList (x: y: "-o " + x + "=" + y) cfg.submissionOptions)} '' + '' pickup unix n - n 60 1 pickup @@ -208,14 +205,17 @@ in enableSubmission = mkOption { type = types.bool; default = false; - description = "Whether to enable smtp submission in master.cf."; + description = "Whether to enable smtp submission"; }; - extraSubmissionOptions = mkOption { - type = types.str; - default = ""; - description = "Extra options for the submission config in master.cf."; - example = "-o milter_macro_daemon_name=ORIGINATING"; + submissionOptions = mkOption { + type = types.attrs; + default = { "smtpd_tls_security_level" = "encrypt"; + "smtpd_sasl_auth_enable" = "yes"; + "smtpd_client_restrictions" = "permit_sasl_authenticated,reject"; + }; + description = "Options for the submission config in master.cf"; + example = { "milter_macro_daemon_name" = "ORIGINATING"; }; }; setSendmail = mkOption {