nixos/parts/modules/base/user.nix
2025-02-18 20:17:57 +01:00

46 lines
1.1 KiB
Nix

{
lib,
options,
username,
config,
...
}:
with lib; let
inherit (config.age) secrets;
in {
options.fireproof = {
username = lib.mkOption {
type = lib.types.str;
default = "nickolaj";
description = "The username of the user";
};
group = lib.mkOption {
type = lib.types.str;
default = "users";
};
home-manager = lib.mkOption {
type = options.home-manager.users.type.functor.wrapped;
};
};
config = {
age.secrets.hashed-user-password.rekeyFile = ../../../secrets/hashed-user-password.age;
users.users.${username} = {
isNormalUser = true;
extraGroups = ["wheel"];
# initialPassword = "password";
hashedPasswordFile = secrets.hashed-user-password.path;
};
home-manager = {
useUserPackages = true;
useGlobalPkgs = true;
};
home-manager.users.${username} = mkAliasDefinitions options.fireproof.home-manager;
# set the same version of home-manager as the system
fireproof.home-manager.home.stateVersion = "24.11";
system.stateVersion = "24.11";
};
}