summary refs log tree commit diff
path: root/nixos/modules/services/mail/dovecot.nix
diff options
context:
space:
mode:
authorNikolay Amiantov <ab@fmap.me>2016-01-07 01:27:06 +0300
committerNikolay Amiantov <ab@fmap.me>2016-01-21 12:53:24 +0300
commit9c7b067c6a22338b91f77638c06f1f9e545755cc (patch)
tree1c5ac6bea9c1476bea979b56183b766a9ed21c4b /nixos/modules/services/mail/dovecot.nix
parentd1a9c55d910af49a93023f9e7de44bdf4a5cc03c (diff)
downloadnixlib-9c7b067c6a22338b91f77638c06f1f9e545755cc.tar
nixlib-9c7b067c6a22338b91f77638c06f1f9e545755cc.tar.gz
nixlib-9c7b067c6a22338b91f77638c06f1f9e545755cc.tar.bz2
nixlib-9c7b067c6a22338b91f77638c06f1f9e545755cc.tar.lz
nixlib-9c7b067c6a22338b91f77638c06f1f9e545755cc.tar.xz
nixlib-9c7b067c6a22338b91f77638c06f1f9e545755cc.tar.zst
nixlib-9c7b067c6a22338b91f77638c06f1f9e545755cc.zip
nixos/dovecot: create user/group only if they are default
Diffstat (limited to 'nixos/modules/services/mail/dovecot.nix')
-rw-r--r--nixos/modules/services/mail/dovecot.nix22
1 files changed, 11 insertions, 11 deletions
diff --git a/nixos/modules/services/mail/dovecot.nix b/nixos/modules/services/mail/dovecot.nix
index e8eaeafff3e9..ae9de6445906 100644
--- a/nixos/modules/services/mail/dovecot.nix
+++ b/nixos/modules/services/mail/dovecot.nix
@@ -178,22 +178,22 @@ in
     security.pam.services.dovecot2 = mkIf cfg.enablePAM {};
 
     users.extraUsers = [
-      { name = cfg.user;
-        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.dovecot2;
-    };
+    ] ++ optional (cfg.user == "dovecot2")
+         { name = "dovecot2";
+           uid = config.ids.uids.dovecot2;
+           description = "Dovecot user";
+           group = cfg.group;
+         };
+
+    users.extraGroups = optional (cfg.group == "dovecot2")
+      { name = "dovecot2";
+        gid = config.ids.gids.dovecot2;
+      };
 
     systemd.services.dovecot2 = {
       description = "Dovecot IMAP/POP3 server";