about summary refs log tree commit diff
path: root/modules/services/mail
diff options
context:
space:
mode:
authorPeter Simons <simons@cryp.to>2012-09-30 00:53:50 +0200
committerPeter Simons <simons@cryp.to>2012-09-30 00:54:03 +0200
commit4b78161e3e68468e858c2618917426a623ef5936 (patch)
treece59ec10f22a008c58010840e946939a042da375 /modules/services/mail
parent1b47614c4628471fbee4a12c0266a324d1792f5d (diff)
downloadnixlib-4b78161e3e68468e858c2618917426a623ef5936.tar
nixlib-4b78161e3e68468e858c2618917426a623ef5936.tar.gz
nixlib-4b78161e3e68468e858c2618917426a623ef5936.tar.bz2
nixlib-4b78161e3e68468e858c2618917426a623ef5936.tar.lz
nixlib-4b78161e3e68468e858c2618917426a623ef5936.tar.xz
nixlib-4b78161e3e68468e858c2618917426a623ef5936.tar.zst
nixlib-4b78161e3e68468e858c2618917426a623ef5936.zip
dovecot: add options to selectively enable/disable the IMAP and/or POP3 listener
Diffstat (limited to 'modules/services/mail')
-rw-r--r--modules/services/mail/dovecot.nix15
1 files changed, 14 insertions, 1 deletions
diff --git a/modules/services/mail/dovecot.nix b/modules/services/mail/dovecot.nix
index 9a9acf69c51b..b4662936b3ca 100644
--- a/modules/services/mail/dovecot.nix
+++ b/modules/services/mail/dovecot.nix
@@ -10,7 +10,7 @@ let
     ''
       base_dir = /var/run/dovecot2/
 
-      protocols = imap pop3
+      protocols = ${optionalString cfg.enableImap "imap"} ${optionalString cfg.enablePop3 "pop3"}
     ''
     + (if cfg.sslServerCert!="" then
     ''
@@ -62,6 +62,16 @@ in
         description = "Whether to enable the Dovecot 2.x POP3/IMAP server.";
       };
 
+      enablePop3 = mkOption {
+        default = true;
+        description = "Start the POP3 listener (when Dovecot is enabled).";
+      };
+
+      enableImap = mkOption {
+        default = true;
+        description = "Start the IMAP listener (when Dovecot is enabled).";
+      };
+
       user = mkOption {
         default = "dovecot2";
         description = "Dovecot user name.";
@@ -146,6 +156,9 @@ in
 
     environment.systemPackages = [ pkgs.dovecot ];
 
+    assertions = [{ assertion = cfg.enablePop3 || cfg.enableImap;
+                    message = "dovecot needs at least one of the IMAP or POP3 listeners enabled";}];
+
   };
 
 }