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

View file

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