Merge pull request #19 from eqyiel/fix-users

Fix r-raymond/nixos-mailserver#18
This commit is contained in:
Robin Raymond 2017-11-05 10:44:18 +01:00 committed by GitHub
commit ca05905e1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 5 deletions

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;
};
}; };
} }