it works???
This commit is contained in:
parent
1dc1e850d2
commit
b2ff2711c4
|
@ -7,5 +7,8 @@
|
||||||
./nixos
|
./nixos
|
||||||
./users/alice.nix
|
./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.useGlobalPkgs = true; # Use global packages in home-manager
|
||||||
home-manager.useUserPackages = true; # Use user 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,8 +19,7 @@ inputs @ { pkgs, lib, ...}: let
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in
|
in {
|
||||||
{
|
|
||||||
imports = [(lib.modules.importApply ./user.nix {
|
imports = [(lib.modules.importApply ./user.nix {
|
||||||
user = {
|
user = {
|
||||||
userName = "alice";
|
userName = "alice";
|
||||||
|
@ -36,4 +35,4 @@ in
|
||||||
userModule = aliceUserFn;
|
userModule = aliceUserFn;
|
||||||
};
|
};
|
||||||
})];
|
})];
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,19 +5,16 @@
|
||||||
# - `packages`: List of packages to install 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.
|
# - `userModule`: A module that provides additional configuration for the user account.
|
||||||
|
|
||||||
{user}: inputs @ {lib, pkgs, ...}:
|
{user}: inputs @ {lib, home-manager, pkgs, ...}:
|
||||||
let
|
let
|
||||||
userName = user.userName or "alice";
|
username = user.userName or "alice";
|
||||||
|
|
||||||
base = import ../options.nix {};
|
base = import ../options.nix {};
|
||||||
in
|
in
|
||||||
let
|
let
|
||||||
homeDirectory = "/home/${userName}";
|
homeDirectory = "/home/${username}";
|
||||||
passwordConfig = lib.mkIf user.defaultPassword {
|
|
||||||
initialPassword = user.defaultPassword;
|
|
||||||
};
|
|
||||||
in {
|
in {
|
||||||
users.users.${userName} = {
|
users.users.${username} = {
|
||||||
shell = user.shell or pkgs.zsh; # Default shell for the user
|
shell = user.shell or pkgs.zsh; # Default shell for the user
|
||||||
|
|
||||||
home = homeDirectory;
|
home = homeDirectory;
|
||||||
|
@ -25,14 +22,18 @@ in {
|
||||||
group = "users"; # Default group
|
group = "users"; # Default group
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
extraGroups = [ "wheel" ]; # Add to wheel group for sudo access
|
extraGroups = [ "wheel" ]; # Add to wheel group for sudo access
|
||||||
} // passwordConfig;
|
} // lib.optionalAttrs (lib.hasAttr "defaultPassword" user) {
|
||||||
|
initialPassword = user.defaultPassword;
|
||||||
|
};
|
||||||
|
|
||||||
home-manager.users.${userName} = {...}: {
|
home-manager.users.${username} = {
|
||||||
imports = [ user.userModule (inputs) ];
|
imports = [ user.userModule ];
|
||||||
|
|
||||||
|
# programs.home-manager.enable = true;
|
||||||
|
|
||||||
home = {
|
home = {
|
||||||
inherit userName;
|
inherit username;
|
||||||
inherit (user) homeDirectory;
|
inherit homeDirectory;
|
||||||
inherit (user) packages;
|
inherit (user) packages;
|
||||||
|
|
||||||
stateVersion = "${base.stateVersion}";
|
stateVersion = "${base.stateVersion}";
|
||||||
|
|
Loading…
Reference in a new issue