nixConfig/nixos/roles/admins.nix

44 lines
1.3 KiB
Nix
Raw Normal View History

2023-11-07 23:47:14 +00:00
{lib, ...}:
with lib; let
admins = {
nerf = {
2023-11-07 23:47:14 +00:00
hashedPassword = "$y$j9T$SJcjUIcs3JYuM5oyxfEQa/$tUBQT07FK4cb9xm.A6ZKVnFIPNOYMOKC6Dt6hadCuJ7";
2024-10-13 11:45:11 +00:00
sshKeys = [
2023-11-07 23:47:14 +00:00
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEdA4LpEGUUmN8esFyrNZXFb2GiBID9/S6zzhcnofQuP nerf@nerflap2"
];
2024-10-13 11:45:11 +00:00
nixKeys = [
"nerflap2-1:pDZCg0oo9PxNQxwVSQSvycw7WXTl53PGvVeZWvxuqJc="
];
};
2023-10-18 15:22:13 +00:00
gonne = {
2023-11-07 23:47:14 +00:00
hashedPassword = "$6$EtGpHEcFkOi0yUWp$slXf0CvIUrhdqaoCrQ5YwtYu2IVuE1RGGst4fnDPRLWVm.lYx0ruvSAF2/vw/sLbW37ORJjlb0NHQ.kSG7cVY/";
2024-10-13 11:45:11 +00:00
sshKeys = [
2024-04-26 16:10:24 +00:00
"sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIAhwkSDISCWLN2GhHfxdZsVkK4J7JoEcPwtNbAesb+BZAAAABHNzaDo= Gonne"
2023-11-07 23:47:14 +00:00
];
2024-10-13 11:45:11 +00:00
nixKeys = [
"gonne.mathebau.de-1:FsXFyFiBFE/JxC9MCkt/WuiXjx5dkRI9RXj0FxOQrV0="
];
2023-10-18 15:22:13 +00:00
};
};
2023-11-07 23:47:14 +00:00
mkAdmin = name: {
hashedPassword,
2024-10-13 11:45:11 +00:00
sshKeys,
...
2023-11-07 23:47:14 +00:00
}: {
"${name}" = {
isNormalUser = true;
createHome = true;
2023-11-07 23:47:14 +00:00
extraGroups = ["wheel"];
group = "users";
home = "/home/${name}";
2024-10-13 11:45:11 +00:00
openssh.authorizedKeys = {keys = sshKeys;};
inherit hashedPassword;
};
};
2024-10-13 11:45:11 +00:00
mkNixKeys = _: {nixKeys, ...}: nixKeys;
in {
users.users = mkMerge (mapAttrsToList mkAdmin admins);
2024-10-13 11:45:11 +00:00
nix.settings.trusted-public-keys = lists.concatLists (mapAttrsToList mkNixKeys admins);
}