-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Fix assertion that config.nixpkgs
cannot be set if useGlobalPkgs
is enabled
#6172
Conversation
This fixes the assertion that `config.nixpkgs` cannot be set if `useGlobalPkgs` is enabled
Been a minute... what's left to get this merged? |
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.
LGTM. I do not think there is anything left to do. The PR just needs to wait for someone to merge it.
CC @rycee . |
I updated my flake.lock this morning only to get this failed assertions error:
Now, I haven't found any nixpkgs options in my home config, and we all know how unhelpful nix errors are. So maybe this should've been a warning and not an error, since I can't update my system anymore even though it was not broken before. Anyway, I set |
@Zerodya, if you use stylix, check this issue. |
Ah, I do. Thank you for pointing me there, I will follow that issue now. |
Same problem here (home manager + stylix + hyprpanel). Hyprpanel is impacted as well. +1 for it to be a warning rather than a hard error, so that we can continue to update home manager until all concerned upstreams have fixed the bug on their side. |
In my case it broke my nixpkgs.config.allowUnfree = true;
nixpkgs.config.allowUnfreePredicate = _: true;
Not sure why, since it's not like it was broken before I guess. |
Temporarily fixes backwards compatibility as issued in nix-community#6172.
Temporarily fixes backwards compatibility as issued in nix-community#6172.
This fixes the assertion that `config.nixpkgs` cannot be set if `useGlobalPkgs` is enabled
Temporarily fixes backwards compatibility as issued in nix-community#6172.
Temporarily fixes backwards compatibility as issued in #6172.
The error has been temporarily removed as of #6466, so updating Home Manager should fix it, but make sure to adapt your configurations nonetheless. |
This allows for setting overlays at the home level while also inheriting the global nixpkgs configuration. This should theoretically work exactly like useGlobalPkgs while still allowing for flexibility at the home level. See nix-community/home-manager#6172
If anybody wants a solution that lets you have the advantages of This is part of a flake-parts module that creates my Perhaps a similar implementation could be added to Home Manager, but there might be some unforeseen problems with this approach (e.g., if a user overrides |
Here is @Silveere 's solution adapted for setups which don't involve
nixpkgs = {
config = lib.mapAttrs (n: v: lib.mkDefault v) osConfig.nixpkgs.config;
# mkOrder 900 is after mkBefore but before default order
overlays = lib.mkOrder 900 osConfig.nixpkgs.overlays;
}; It silences the warning, but it really should be fixed in all upstreams projects. |
I'm very sorry i caused so much of a stirr with this change -- good learning experience to consider the impact of my code, i suppose |
Don't worry, this was a learning experience for all of us. You fixed a bug which was clearly not intended and needed to be addressed. Although an intermediate warning would have been nice, this quickly urged configs and libraries to be updated, which was bound to happen sooner or later. Luckily it seems that pretty much only Stylix users were affected by this and it was all resolved within a day or two. But you're right, it really shows what unforeseen consequences a simple change can have! |
Yeah, how are you supposed to modify the nixpkgs config then? It would be good if that was documented somewhere. I got this for the |
@RossSmyth You're using |
This fixes the assertion that `config.nixpkgs` cannot be set if `useGlobalPkgs` is enabled
Temporarily fixes backwards compatibility as issued in nix-community#6172.
Description
When
useGlobalPkgs
is enabled, settingnixpkgs.config
andnixpkgs.overlays
in the home config has no effect. There is an assertion in place intended to throw an error if the user tries to set these options in this scenario, but it uses an OR instead of an AND, allowing for one of them to be set. This PR replaces this OR for an AND.Fixes #6079.
Checklist
Change is backwards compatible.
Code formatted with
./format
.Code tested through
nix-shell --pure tests -A run.all
ornix develop --ignore-environment .#all
using Flakes.Test cases updated/added. See example.
Commit messages are formatted like
See CONTRIBUTING for more information and recent commit messages for examples.
If this PR adds a new module
Maintainer CC
@thiagokokada