it works???

This commit is contained in:
Janis 2025-07-18 00:13:17 +02:00
parent 1dc1e850d2
commit b2ff2711c4
4 changed files with 37 additions and 31 deletions

View file

@ -7,5 +7,8 @@
./nixos
./users/alice.nix
];
# to use zsh as a login shell, it has to be enabled globally.
programs.zsh.enable = true;
}

View file

@ -24,9 +24,12 @@
{
home-manager.useGlobalPkgs = true; # Use global packages in home-manager
home-manager.useUserPackages = true; # Use user packages in home-manager
# home-manager.users.alice = ./users/alice.nix; # Define user-specific home-manager configuration
}
];
specialArgs = {
inherit home-manager;
};
};
};
};

View file

@ -19,8 +19,7 @@ inputs @ { pkgs, lib, ...}: let
};
};
};
in
{
in {
imports = [(lib.modules.importApply ./user.nix {
user = {
userName = "alice";
@ -36,4 +35,4 @@ in
userModule = aliceUserFn;
};
})];
}
}

View file

@ -5,19 +5,16 @@
# - `packages`: List of packages to install for the user account.
# - `userModule`: A module that provides additional configuration for the user account.
{user}: inputs @ {lib, pkgs, ...}:
{user}: inputs @ {lib, home-manager, pkgs, ...}:
let
userName = user.userName or "alice";
username = user.userName or "alice";
base = import ../options.nix {};
in
let
homeDirectory = "/home/${userName}";
passwordConfig = lib.mkIf user.defaultPassword {
initialPassword = user.defaultPassword;
};
homeDirectory = "/home/${username}";
in {
users.users.${userName} = {
users.users.${username} = {
shell = user.shell or pkgs.zsh; # Default shell for the user
home = homeDirectory;
@ -25,14 +22,18 @@ in {
group = "users"; # Default group
isNormalUser = true;
extraGroups = [ "wheel" ]; # Add to wheel group for sudo access
} // passwordConfig;
} // lib.optionalAttrs (lib.hasAttr "defaultPassword" user) {
initialPassword = user.defaultPassword;
};
home-manager.users.${userName} = {...}: {
imports = [ user.userModule (inputs) ];
home-manager.users.${username} = {
imports = [ user.userModule ];
# programs.home-manager.enable = true;
home = {
inherit userName;
inherit (user) homeDirectory;
inherit username;
inherit homeDirectory;
inherit (user) packages;
stateVersion = "${base.stateVersion}";