-
-
Notifications
You must be signed in to change notification settings - Fork 15.5k
NixOS: use overlays when nixpkgs.pkgs is set #49256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me.
Motivation for this change
In the current situation, when specifying
nixpkgs.pkgs
in NixOS, thenixpkgs.overlays
option is ignored. Now that we havepkgs.extend
since #47430, we can actually support the combination.It makes the
nixpkgs
options a bit more predictable and whenpkgs.nixosTest
#47684 is merged, this will enable project-specific NixOS tests to reusepkgs
while also supporting test machine-specific overlays.Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)