servers/common/users/admin.nix

43 lines
850 B
Nix
Raw Normal View History

2025-01-26 19:21:36 -06:00
{
config,
lib,
foelib,
...
2026-02-24 00:00:35 -08:00
}:
let
inherit (lib)
mkIf
mkOption
mkEnableOption
optionals
types
;
2025-01-26 19:21:36 -06:00
cfg = config.foehammer.users.admin;
2026-02-24 00:00:35 -08:00
in
{
2025-02-03 13:00:31 -06:00
options.foehammer.users.admin = {
enable = mkEnableOption "Enable a wheel admin user.";
hashedPasswordFile = mkOption {
type = with types; nullOr str;
default = null;
};
};
2025-01-26 19:21:36 -06:00
config = mkIf cfg.enable {
users.users.admin = {
createHome = true;
description = "SSH Admin User.";
group = "admin";
2026-02-24 00:00:35 -08:00
extraGroups = [ "wheel" ] ++ optionals config.virtualisation.docker.enable [ "docker" ];
2025-01-26 19:21:36 -06:00
isNormalUser = true;
uid = 9999;
openssh.authorizedKeys.keys = foelib.getSSHKeys "foehammer";
2025-02-03 13:00:31 -06:00
hashedPasswordFile = cfg.hashedPasswordFile;
2025-01-26 19:21:36 -06:00
};
users.groups.admin.gid = config.users.users.admin.uid;
};
}