From e91d237d8109b27214378044c61fcab4f4ee8eeb Mon Sep 17 00:00:00 2001 From: Ruben Maher Date: Sun, 5 Nov 2017 19:12:39 +1030 Subject: [PATCH] Fix r-raymond/nixos-mailserver#18 --- mail-server/users.nix | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/mail-server/users.nix b/mail-server/users.nix index a8cbcc9..e3fad42 100644 --- a/mail-server/users.nix +++ b/mail-server/users.nix @@ -19,14 +19,14 @@ with config.mailserver; let - vmail_user = [{ + vmail_user = { name = vmailUserName; isNormalUser = false; uid = vmailUIDStart; home = mailDirectory; createHome = true; group = vmailGroupName; - }]; + }; # accountsToUser :: String -> UserRecord accountsToUser = account: { @@ -36,8 +36,9 @@ let inherit (account) hashedPassword; }; - # mail_user :: [ UserRecord ] - mail_user = map accountsToUser (lib.attrValues loginAccounts); + # mail_users :: { [String]: UserRecord } + mail_users = lib.foldl (prev: next: prev // { "${next.name}" = next; }) {} + (map accountsToUser (lib.attrValues loginAccounts)); in { @@ -49,6 +50,8 @@ in }; # define all users - users.extraUsers = vmail_user ++ mail_user; + users.users = mail_users // { + "${vmail_user.name}" = lib.mkForce vmail_user; + }; }; }