From 9c7b067c6a22338b91f77638c06f1f9e545755cc Mon Sep 17 00:00:00 2001 From: Nikolay Amiantov Date: Thu, 7 Jan 2016 01:27:06 +0300 Subject: [PATCH] nixos/dovecot: create user/group only if they are default --- nixos/modules/services/mail/dovecot.nix | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 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; } - ]; + ] ++ optional (cfg.user == "dovecot2") + { name = "dovecot2"; + uid = config.ids.uids.dovecot2; + description = "Dovecot user"; + group = cfg.group; + }; - users.extraGroups = singleton { - name = cfg.group; - gid = config.ids.gids.dovecot2; - }; + users.extraGroups = optional (cfg.group == "dovecot2") + { name = "dovecot2"; + gid = config.ids.gids.dovecot2; + }; systemd.services.dovecot2 = { description = "Dovecot IMAP/POP3 server";