Author: viric
Date: Thu Oct 27 19:43:20 2011
New Revision: 30072
URL: https://nixos.org/websvn/nix/?rev=30072&sc=1

Log:
Adding a module for dovecot2. I've not tried it much.

Added:
   nixos/trunk/modules/services/mail/dovecot2.nix
      - copied, changed from r30046, 
nixos/trunk/modules/services/mail/dovecot.nix
Modified:
   nixos/trunk/modules/misc/ids.nix
   nixos/trunk/modules/module-list.nix

Modified: nixos/trunk/modules/misc/ids.nix
==============================================================================
--- nixos/trunk/modules/misc/ids.nix    Thu Oct 27 19:36:03 2011        (r30071)
+++ nixos/trunk/modules/misc/ids.nix    Thu Oct 27 19:43:20 2011        (r30072)
@@ -64,6 +64,8 @@
     fourStoreEndpoint = 43;
     virtuoso = 44;
     rtkit = 45;
+    dovecot2 = 46;
+    dovenull2 = 47;
 
     # When adding a uid, make sure it doesn't match an existing gid.
 
@@ -110,6 +112,7 @@
     fourStore = 42;
     fourStoreEndpoint = 43;
     virtuoso = 44;
+    dovecot2 = 45;
 
     # When adding a gid, make sure it doesn't match an existing uid.
 

Modified: nixos/trunk/modules/module-list.nix
==============================================================================
--- nixos/trunk/modules/module-list.nix Thu Oct 27 19:36:03 2011        (r30071)
+++ nixos/trunk/modules/module-list.nix Thu Oct 27 19:43:20 2011        (r30072)
@@ -73,6 +73,7 @@
   ./services/logging/logrotate.nix
   ./services/logging/syslogd.nix
   ./services/mail/dovecot.nix
+  ./services/mail/dovecot2.nix
   ./services/mail/freepops.nix
   ./services/mail/mail.nix
   ./services/mail/postfix.nix

Copied and modified: nixos/trunk/modules/services/mail/dovecot2.nix (from 
r30046, nixos/trunk/modules/services/mail/dovecot.nix)
==============================================================================
--- nixos/trunk/modules/services/mail/dovecot.nix       Wed Oct 26 19:37:47 
2011        (r30046, copy source)
+++ nixos/trunk/modules/services/mail/dovecot2.nix      Thu Oct 27 19:43:20 
2011        (r30072)
@@ -6,13 +6,13 @@
 
   startingDependency = if config.services.gw6c.enable then "gw6c" else 
"network-interfaces";
 
-  cfg = config.services.dovecot;
+  cfg = config.services.dovecot2;
 
   dovecotConf =
     ''
-      base_dir = /var/run/dovecot/
+      base_dir = /var/run/dovecot2/
 
-      protocols = imap imaps pop3 pop3s
+      protocols = imap pop3
     ''
     + (if cfg.sslServerCert!="" then
     ''
@@ -20,32 +20,33 @@
       ssl_key_file = ${cfg.sslServerKey}
       ssl_ca_file = ${cfg.sslCACert}
     '' else ''
-      ssl_disable = yes
+      ssl = no
       disable_plaintext_auth = no
     '')
 
     + ''
-      login_user = ${cfg.user}
-      login_chroot = no
+      default_internal_user = ${cfg.user}
 
       mail_location = maildir:/var/spool/mail/%u
 
       maildir_copy_with_hardlinks = yes
 
-      auth default {
-        mechanisms = plain login
-        userdb passwd {
-        }
-        passdb pam {
-        }
+      auth_mechanisms = plain login
+      service auth {
         user = root
       }
+      userdb {
+        driver=passwd
+      }
+      passdb {
+        driver=pam
+      }
       auth_debug = yes
       auth_verbose = yes
 
       pop3_uidl_format = %08Xv%08Xu
 
-      log_path = /var/log/dovecot.log
+      log_path = /var/log/dovecot2.log
     '';
 
   confFile = pkgs.writeText "dovecot.conf" dovecotConf;
@@ -58,20 +59,20 @@
 
   options = {
 
-    services.dovecot = {
+    services.dovecot2 = {
 
       enable = mkOption {
         default = false;
-        description = "Whether to enable the Dovecot POP3/IMAP server.";
+        description = "Whether to enable the Dovecot 2.x POP3/IMAP server.";
       };
 
       user = mkOption {
-        default = "dovecot";
+        default = "dovecot2";
         description = "Dovecot user name.";
       };
 
       group = mkOption {
-        default = "dovecot";
+        default = "dovecot2";
         description = "Dovecot group name.";
       };
 
@@ -97,34 +98,40 @@
 
   ###### implementation
 
-  config = mkIf config.services.dovecot.enable {
+  config = mkIf config.services.dovecot2.enable {
 
-    security.pam.services = [ { name = "dovecot"; } ];
+    security.pam.services = [ { name = "dovecot2"; } ];
 
-    users.extraUsers = singleton
+    users.extraUsers = [
       { name = cfg.user;
-        uid = config.ids.uids.dovecot;
+        uid = config.ids.uids.dovecot2;
         description = "Dovecot user";
         group = cfg.group;
-      };
+      }
+      { name = "dovenull";
+        uid = config.ids.uids.dovenull2;
+        description = "Dovecot user for untrusted logins";
+        group = cfg.group;
+      }
+    ];
 
     users.extraGroups = singleton
       { name = cfg.group;
-        gid = config.ids.gids.dovecot;
+        gid = config.ids.gids.dovecot2;
       };
 
-    jobs.dovecot =
+    jobs.dovecot2 =
       { description = "Dovecot IMAP/POP3 server";
 
         startOn = "started ${startingDependency}";
 
         preStart =
           ''
-            ${pkgs.coreutils}/bin/mkdir -p /var/run/dovecot 
/var/run/dovecot/login
-            ${pkgs.coreutils}/bin/chown -R ${cfg.user}.${cfg.group} 
/var/run/dovecot
+            ${pkgs.coreutils}/bin/mkdir -p /var/run/dovecot2 
/var/run/dovecot2/login
+            ${pkgs.coreutils}/bin/chown -R ${cfg.user}.${cfg.group} 
/var/run/dovecot2
           '';
 
-        exec = "${pkgs.dovecot}/sbin/dovecot -F -c ${confFile}";
+        exec = "${pkgs.dovecot_2_0}/sbin/dovecot -F -c ${confFile}";
       };
 
   };
_______________________________________________
nix-commits mailing list
nix-comm...@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-commits

Reply via email to