nixos/hosts/common/users/admin/default.nix

40 lines
966 B
Nix
Raw Normal View History

2024-05-14 14:51:09 +01:00
{ pkgs, inputs, config, lib, ... }:
let
2024-05-27 15:04:34 +01:00
username = "admin";
2025-01-19 19:18:31 +00:00
pubKeys = lib.filesystem.listFilesRecursive ../keys;
2024-05-27 15:04:34 +01:00
hostname = config.networking.hostName;
2025-01-19 19:18:31 +00:00
sopsHashedPasswordFile = config.sops.secrets."passwords/${username}".path;
2024-05-27 15:04:34 +01:00
secretsDirectory = builtins.toString inputs.nix-secrets;
secretsFile = "${secretsDirectory}/secrets.yaml";
in
2024-05-14 14:51:09 +01:00
{
2024-05-27 15:04:34 +01:00
users.users.${username} = {
2024-05-14 14:51:09 +01:00
isNormalUser = true;
2025-01-19 19:18:31 +00:00
shell = pkgs.zsh;
2024-05-27 15:04:34 +01:00
hashedPasswordFile = sopsHashedPasswordFile;
2024-05-14 14:51:09 +01:00
openssh.authorizedKeys.keys = lib.lists.forEach pubKeys (key: builtins.readFile key);
extraGroups = [
"wheel"
2024-05-27 15:04:34 +01:00
];
};
sops.secrets = {
"passwords/${username}" = {
sopsFile = "${secretsFile}";
neededForUsers = true;
};
2024-05-14 14:51:09 +01:00
};
programs.zsh.enable = true;
2024-05-27 15:04:34 +01:00
programs.fuse.userAllowOther = true;
2024-05-14 14:51:09 +01:00
2024-05-27 15:04:34 +01:00
home-manager = {
extraSpecialArgs = { inherit inputs; };
users = {
${username} = import ../../../../home/${hostname}.nix;
};
};
2024-05-14 14:51:09 +01:00
}