47 lines
1.2 KiB
Nix
47 lines
1.2 KiB
Nix
# `user` has the following attributes:
|
|
# - `userName`: The username for the user account.
|
|
# - `defaultPassword`: The default password for the user account.
|
|
# - `shell`: The shell for the user account.
|
|
# - `packages`: List of packages to install for the user account.
|
|
# - `userModule`: A module that provides additional configuration for the user account.
|
|
|
|
{user}: inputs @ {lib, home-manager, pkgs, ...}:
|
|
let
|
|
username = user.userName or "alice";
|
|
|
|
base = import ../options.nix {};
|
|
in
|
|
let
|
|
homeDirectory = "/home/${username}";
|
|
in {
|
|
users.users.${username} = {
|
|
shell = user.shell or pkgs.zsh; # Default shell for the user
|
|
|
|
home = homeDirectory;
|
|
createHome = true;
|
|
group = "users"; # Default group
|
|
isNormalUser = true;
|
|
extraGroups = [ "wheel" ]; # Add to wheel group for sudo access
|
|
} // lib.optionalAttrs (lib.hasAttr "defaultPassword" user) {
|
|
initialPassword = user.defaultPassword;
|
|
};
|
|
|
|
home-manager.users.${username} = {
|
|
imports = [ user.userModule ];
|
|
|
|
# programs.home-manager.enable = true;
|
|
|
|
home = {
|
|
inherit username;
|
|
inherit homeDirectory;
|
|
inherit (user) packages;
|
|
|
|
stateVersion = "${base.stateVersion}";
|
|
|
|
sessionVariables = {
|
|
EDITOR = user.editor or "vim";
|
|
};
|
|
};
|
|
};
|
|
}
|