This commit is contained in:
Ruben Maher 2017-11-05 19:12:39 +10:30
parent 47f742fb83
commit e91d237d81

View file

@ -19,14 +19,14 @@
with config.mailserver; with config.mailserver;
let let
vmail_user = [{ vmail_user = {
name = vmailUserName; name = vmailUserName;
isNormalUser = false; isNormalUser = false;
uid = vmailUIDStart; uid = vmailUIDStart;
home = mailDirectory; home = mailDirectory;
createHome = true; createHome = true;
group = vmailGroupName; group = vmailGroupName;
}]; };
# accountsToUser :: String -> UserRecord # accountsToUser :: String -> UserRecord
accountsToUser = account: { accountsToUser = account: {
@ -36,8 +36,9 @@ let
inherit (account) hashedPassword; inherit (account) hashedPassword;
}; };
# mail_user :: [ UserRecord ] # mail_users :: { [String]: UserRecord }
mail_user = map accountsToUser (lib.attrValues loginAccounts); mail_users = lib.foldl (prev: next: prev // { "${next.name}" = next; }) {}
(map accountsToUser (lib.attrValues loginAccounts));
in in
{ {
@ -49,6 +50,8 @@ in
}; };
# define all users # define all users
users.extraUsers = vmail_user ++ mail_user; users.users = mail_users // {
"${vmail_user.name}" = lib.mkForce vmail_user;
};
}; };
} }