machines-config/nixosModules/users/default.nix

28 lines
623 B
Nix
Raw Normal View History

2024-12-18 23:14:56 +01:00
{ config, lib, ... }:
let
cfg = config.kropcloud.admin;
in
{
options.kropcloud.admin = {
user = lib.mkOption {
type = lib.types.str;
default = "krop";
description = "Name of the admin user to be created.";
};
sshKeys = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
description = "List of SSH public keys to authorize for the admin user.";
};
};
config = {
# Define the admin user
users.users.${cfg.user} = {
isNormalUser = true;
extraGroups = [ "wheel" ];
openssh.authorizedKeys.keys = cfg.sshKeys;
};
};
}