Set users and ssh auth keys for guest nodes

This commit is contained in:
pazpi 2024-08-27 11:21:07 +02:00
parent 86fcab13a9
commit a6a0f2650d

View file

@ -0,0 +1,45 @@
{
lib,
config,
pkgs,
...
}:
let
cfg = config.serverUsers;
in
{
options.serverUsers = {
enable = lib.mkEnableOption "Set users for server hosts";
};
config = lib.mkIf cfg.enable {
users = {
# If set to false, the contents of the user and group files will simply
# be replaced on system activation.
# This also holds for the user passwords.
# All changed passwords will be reset according
# to the `users.users` configuration on activation.
mutableUsers = false;
users.root = {
hashedPassword = "!";
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDhiGLc/whCY3lCmDiRlYnMJOLiO/gvcRj/sKVEFVAhQ pazpi@deadbeef"
];
};
users.pazpi = {
isNormalUser = true;
hashedPassword = "$y$j9T$oWLCV1hnGPyOGabMfAS3p1$/iwouRZGwQXcv6IHnLuT3I9.pmeXNpcHxq.b8xfitr1";
shell = pkgs.bash;
extraGroups = [ "wheel" ];
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDhiGLc/whCY3lCmDiRlYnMJOLiO/gvcRj/sKVEFVAhQ pazpi@deadbeef"
];
};
};
};
}