it works???
This commit is contained in:
parent
1dc1e850d2
commit
b2ff2711c4
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -19,21 +19,20 @@ inputs @ { pkgs, lib, ...}: let
|
|||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
imports = [(lib.modules.importApply ./user.nix {
|
||||
user = {
|
||||
userName = "alice";
|
||||
defaultPassword = "password";
|
||||
shell = pkgs.zsh;
|
||||
packages = with pkgs; [
|
||||
tree
|
||||
vim
|
||||
wget
|
||||
curl
|
||||
git
|
||||
];
|
||||
userModule = aliceUserFn;
|
||||
};
|
||||
})];
|
||||
}
|
||||
in {
|
||||
imports = [(lib.modules.importApply ./user.nix {
|
||||
user = {
|
||||
userName = "alice";
|
||||
defaultPassword = "password";
|
||||
shell = pkgs.zsh;
|
||||
packages = with pkgs; [
|
||||
tree
|
||||
vim
|
||||
wget
|
||||
curl
|
||||
git
|
||||
];
|
||||
userModule = aliceUserFn;
|
||||
};
|
||||
})];
|
||||
}
|
||||
|
|
|
@ -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}";
|
||||
|
|
Loading…
Reference in a new issue