fix: ensure overlays are passed to all possible nixpkgs instances - #146
Conversation
devurandom
left a comment
There was a problem hiding this comment.
This would fix #115, where it is reported that the config is applied to Home Manager, but not to NixOS.
I was interested to compared the approach of this PR with how it works for Home Manager:
Lines 231 to 237 in 06ee719
Lines 343 to 361 in 06ee719
home-manager.nixosModules.default is:
I was unable to figure out how nixpkgs.config ends up being used by home-manager.nixosModules.default (under blueprint's setting of useGlobalPkgs = true, which sets useNixpkgsModule = false), neither in the code traced here nor in the surrounding code.
Could you please explain why this happens in the first place for NixOS / why it does not happen within home manager?
Setting nixpkgs.config/overlays in the host module makes the
NixOS/nix-darwin module system import nixpkgs again per host with the
same settings blueprint already used for systemArgs.${system}.pkgs.
Hand that instance over via nixpkgs.pkgs instead so packages, devshells
and hosts share one evaluation.
Only injected when blueprint actually has nixpkgs.config/overlays set,
so hosts that manage their own nixpkgs.* are unaffected. mkDefault lets
a host override with its own nixpkgs.pkgs.
A host that previously set nixpkgs.overlays alongside blueprint's now
needs to extend the shared instance explicitly
(nixpkgs.pkgs = lib.mkForce (perSystem.nixpkgs.extend extra)) since the
NixOS module ignores nixpkgs.overlays when nixpkgs.pkgs is set.
You traced the HM-inside-NixOS path ( The path where it does work is the standalone HM entry point, which is what the #115 reporter inspected ( Lines 330 to 341 in 06ee719 Lines 293 to 294 in 06ee719 Here
Lines 350 to 360 in 06ee719 So the NixOS module system instantiates its own from I've pushed a follow-up commit that fixes it the same way standalone HM already works: hand over Also rebased onto current |
Tried to apply an overlay to get around the current boost 1.89 situation on nixpkgs only to find it wasn't actually being applied everywhere and neither was nixpkgs.config. Added an extra module to ensure that they are passed to
config.nixpkgstoo.