NixOS: use overlays when nixpkgs.pkgs is set#49256
Conversation
| inherit (cfg) config overlays localSystem crossSystem; | ||
| }; | ||
|
|
||
| finalPkgs = if opt.pkgs.isDefined then cfg.pkgs.appendOverlays cfg.overlays else defaultPkgs; |
There was a problem hiding this comment.
I'm not so sure about this. While I see the use case of setting pkgs and overlays, there's no reason you can't set overlays yourself when you init pkgs. Since we don't do this for config, crossSystem, or localSystem, it seems a little unexpected. We probably should have an assertion for those so that you don't set pkgs and something that has no effect.
There was a problem hiding this comment.
I was going to add the assertion when I ran into #49765. I actually wrote the assertion yesterday, but forgot to push it here. I don't think it is necessary to add the other assertion about the host system.
There was a problem hiding this comment.
Regarding whether we should, this elegantly enables a use case pointed out by aszlig for nixosTest where one of the machines has an extra overlay. So that is one reason why you can't set overlays yourself when you init pkgs.
We could support the other options but I can't tell at this point how well that would work.
Motivation for this change
In the current situation, when specifying
nixpkgs.pkgsin NixOS, thenixpkgs.overlaysoption is ignored. Now that we havepkgs.extendsince #47430, we can actually support the combination.It makes the
nixpkgsoptions a bit more predictable and whenpkgs.nixosTest#47684 is merged, this will enable project-specific NixOS tests to reusepkgswhile also supporting test machine-specific overlays.Things done
sandboxinnix.confon non-NixOS)nix-shell -p nox --run "nox-review wip"./result/bin/)nix path-info -Sbefore and after)