selfprivacy-nixos-config/users.nix

27 lines
631 B
Nix
Raw Permalink Normal View History

{ config, ... }:
2021-11-15 12:29:20 +02:00
let
cfg = config.selfprivacy;
2021-11-15 12:29:20 +02:00
in
2021-11-15 12:02:05 +02:00
{
users = {
mutableUsers = false;
allowNoPasswordLogin = true;
2021-11-15 12:02:05 +02:00
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
};
}