fix nixpkgs disabled when home-manager.useGlobalPkgs

This commit is contained in:
do butterflies cry? 2026-03-07 20:10:36 +10:00
parent 1c68485dcf
commit 39ec2e62d0
Signed by: cry
GPG key ID: F68745A836CA0412
2 changed files with 13 additions and 10 deletions

View file

@ -62,8 +62,8 @@ in {
users =
config.users.users
|> filterAttrs (name: value: value.manageHome && pathExists /${root}/homes/${name})
|> mapAttrs (name: _: {
imports = [import /${root}/homes/${name}];
|> mapAttrs (name: _: {...}: {
imports = [/${root}/homes/${name}];
# per-user arguments
_module.args.username = name;
@ -73,7 +73,6 @@ in {
sharedModules = [
../home
# user configuration
(import /${root}/nixpkgs.nix)
# options declarations
(import ./nixpkgs.nix (args // {contextName = "homes";}))

View file

@ -73,19 +73,23 @@ in {
_module.args = removeAttrs repos ["pkgs" "base"];
nixpkgs = let
nixpkgConfig = {
nixpkgsConfig = {
config = lib.mkForce (basePkgs.config or {});
overlays = lib.mkForce (basePkgs.overlays or []);
};
in
if contextName == "hosts"
then
nixpkgConfig
nixpkgsHostsConfig =
nixpkgsConfig
// {
flake.source = lib.mkForce base;
}
};
nixpkgsHomesConfig = lib.mkIf (!config.home-manager.useGlobalPkgs) nixpkgsConfig;
in
if contextName == "hosts"
then nixpkgsHostsConfig
else if contextName == "homes"
then nixpkgConfig
then nixpkgsHomesConfig
else {};
};
}