diff options
author | Nikolay Amiantov <ab@fmap.me> | 2016-01-10 06:54:07 +0300 |
---|---|---|
committer | Nikolay Amiantov <ab@fmap.me> | 2016-01-21 12:53:25 +0300 |
commit | b2b58642fedd4b315bf8b92a3352792fa3d77bce (patch) | |
tree | a68b567e35f96bca628403c1179255723455d214 /nixos/modules/services/mail/dovecot.nix | |
parent | 122929cda74f92555c40e9888c968e02611cb3e8 (diff) | |
download | nixlib-b2b58642fedd4b315bf8b92a3352792fa3d77bce.tar nixlib-b2b58642fedd4b315bf8b92a3352792fa3d77bce.tar.gz nixlib-b2b58642fedd4b315bf8b92a3352792fa3d77bce.tar.bz2 nixlib-b2b58642fedd4b315bf8b92a3352792fa3d77bce.tar.lz nixlib-b2b58642fedd4b315bf8b92a3352792fa3d77bce.tar.xz nixlib-b2b58642fedd4b315bf8b92a3352792fa3d77bce.tar.zst nixlib-b2b58642fedd4b315bf8b92a3352792fa3d77bce.zip |
nixos/dovecot: add 'protocols' option
Diffstat (limited to 'nixos/modules/services/mail/dovecot.nix')
-rw-r--r-- | nixos/modules/services/mail/dovecot.nix | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/nixos/modules/services/mail/dovecot.nix b/nixos/modules/services/mail/dovecot.nix index c9406a2ac516..e244bdbd30bb 100644 --- a/nixos/modules/services/mail/dovecot.nix +++ b/nixos/modules/services/mail/dovecot.nix @@ -9,16 +9,10 @@ let baseDir = "/run/dovecot2"; stateDir = "/var/lib/dovecot"; - protocols = concatStrings [ - (optionalString cfg.enableImap "imap") - (optionalString cfg.enablePop3 "pop3") - (optionalString cfg.enableLmtp "lmtp") - ]; - dovecotConf = concatStrings [ '' base_dir = ${baseDir} - protocols = ${protocols} + protocols = ${concatStringsSep " " cfg.protocols} '' (if isNull cfg.sslServerCert then '' @@ -87,6 +81,12 @@ in description = "Start the LMTP listener (when Dovecot is enabled)."; }; + protocols = mkOption { + type = types.listOf types.str; + default = [ ]; + description = "Additional listeners to start when Dovecot is enabled."; + }; + package = mkOption { type = types.package; default = pkgs.dovecot22; @@ -177,6 +177,11 @@ in security.pam.services.dovecot2 = mkIf cfg.enablePAM {}; + services.dovecot2.protocols = + optional cfg.enableImap "imap" + ++ optional cfg.enablePop3 "pop3" + ++ optional cfg.enableLmtp "lmtp"; + users.extraUsers = [ { name = "dovenull"; uid = config.ids.uids.dovenull2; @@ -220,7 +225,7 @@ in environment.systemPackages = [ dovecotPkg ]; assertions = [ - { assertion = cfg.enablePop3 || cfg.enableImap; + { assertion = intersectLists cfg.protocols [ "pop3" "imap" ] != []; message = "dovecot needs at least one of the IMAP or POP3 listeners enabled"; } { assertion = isNull cfg.sslServerCert == isNull cfg.sslServerKey |