servers/common/users/admin.nix

35 lines
821 B
Nix
Raw Permalink Normal View History

2025-01-26 19:21:36 -06:00
{
config,
lib,
foelib,
...
}: let
2025-02-03 13:00:31 -06:00
inherit (lib) mkIf mkOption mkEnableOption optionals types;
2025-01-26 19:21:36 -06:00
cfg = config.foehammer.users.admin;
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";
extraGroups = ["wheel"] ++ optionals config.virtualisation.docker.enable ["docker"];
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;
};
}