selfprivacy-nixos-config/users.nix

41 lines
1.0 KiB
Nix
Raw Normal View History

2021-11-15 12:02:05 +02:00
{ pkgs, config, ... }:
2021-11-15 12:29:20 +02:00
let
cfg = config.services.userdata;
in
2021-11-15 12:02:05 +02:00
{
users.mutableUsers = false;
users = {
users = {
2021-11-15 12:29:20 +02:00
"${cfg.username}" = {
2021-11-15 12:02:05 +02:00
isNormalUser = true;
2021-11-15 12:29:20 +02:00
hashedPassword = cfg.hashedMasterPassword;
openssh.authorizedKeys.keys = cfg.sshKeys;
2021-11-15 12:02:05 +02:00
};
2021-11-15 12:29:20 +02:00
} // builtins.listToAttrs (builtins.map
(user: {
name = "${user.username}";
value = {
isNormalUser = true;
hashedPassword = user.hashedPassword;
openssh.authorizedKeys.keys = (if user ? sshKeys then user.sshKeys else [ ]);
2021-11-15 12:29:20 +02:00
};
})
cfg.users);
2021-11-15 12:02:05 +02:00
};
selfprivacy.ldap = {
enable = true;
domain = "${cfg.domain}";
rootUser = "${cfg.username}";
rootHashedPassword = cfg.hashedMasterPassword;
2023-03-28 21:35:23 +03:00
users =
(builtins.map
(user: {
username = "${user.username}";
email = "${user.username}@${cfg.domain}";
hashedPassword = user.hashedPassword;
2023-03-28 21:37:05 +03:00
groups = [ "gitea" "nextcloud" "pleroma" "mastodon" ];
})
2023-03-28 21:35:23 +03:00
cfg.users);
};
2021-11-15 12:02:05 +02:00
}