pkgs/top-level/stage.nix: move most nixpkgs sets to variants#400351
pkgs/top-level/stage.nix: move most nixpkgs sets to variants#400351RossComputerGuy merged 1 commit intoNixOS:masterfrom
Conversation
5e41f62 to
3f3fcf0
Compare
3f3fcf0 to
4585e60
Compare
|
I like the basic idea, which is to make sure that no references to those package sets can sneak into other nixpkgs code. In the best case, all the remaining package sets like pkgsStatic etc. would also be variants. But I guess they are currently referenced in nixpkgs, so that won't work. And also, the breaking change would be much bigger. But that still doesn't convince me, that adding those variants like I think we are conflating two issues here:
We should only add package sets for the first reason, not "for better UX". Maybe we can think about better UX separately. Why is passing those via system on the command line so hard? OK, I tried it. I need:
Really annoying that I have to pass my own system as well. Doing Maybe we can introduce some kind of attribute-based-config system for CLI UX? I'm thinking of doing something like: Where:
This way, we have better UX, but don't need to add package sets all the time. Maybe we can also do shortcuts like |
a48535d to
f3f6e5c
Compare
I feel like this kinda answers itself. Plus, once #365057 is merged and we stop supporting
I agree but I think we should stick to the variants approach until we're able to design a better system. It'll also likely be some amount of time we want both for compatibility. |
f3f6e5c to
e12e396
Compare
|
Yeah this is good. I look forward to everything being moved! |
|
This is a breaking change for everyone using one of those package sets right now, so I say we can't merge this before branch-off anymore. |
|
Is it a breaking change? It only really effects people if they turn off |
alyssais
left a comment
There was a problem hiding this comment.
Love the direction. Glad somebody is finally getting around to this.
pkgs/top-level/config.nix
Outdated
There was a problem hiding this comment.
They're not really subsets. They contain just as much as the original set.
There was a problem hiding this comment.
What's a better way to explaining it?
There was a problem hiding this comment.
They're differently instantiated package sets.
There was a problem hiding this comment.
I've reworded things slightly, idk if that's any better.
pkgs/top-level/stage.nix
Outdated
There was a problem hiding this comment.
Given how simple this was before I'm not sure the quite complex mkOptionalOverlay function is worth it?
There was a problem hiding this comment.
Ok, I've dropped the commit which did that. We can figure something out later.
doc/release-notes/rl-2505.section.md
Outdated
There was a problem hiding this comment.
I don't think that's a desirable change — one of the reasons to disable aliases is to get rid of throws when iterating over package sets. Usually that's only relevant for sets below the top level but I don't think we'd want the top level to work confusingly differently.
There was a problem hiding this comment.
Hmm, would we want to add another option for turning off the optional overlay?
b662e26 to
58b5540
Compare
pkgs/top-level/config.nix
Outdated
There was a problem hiding this comment.
| This allows for using different toolchains, libc's, or global build changes across nixpkgs. | |
| This allows for using different toolchains, libcs, or global build changes across nixpkgs. |
And maybe it would be good to explain why you'd want to enable/disable this?
pkgs/top-level/stage.nix
Outdated
There was a problem hiding this comment.
This complicated function is still here and is now only used once.
|
I am still a bit confused, because I hate variants but like this PR. If we want to provide short-hands, that can still be in the hydra jobset, but a new attribute set. Likewise for the CLI. Perhaps making those new entry points is sort of the stuff that @wolfgangwalther is already planning. I don't really worry about drift in the meaning of "aliases" as that also seems like something we can clear up after the fact? |
|
Yeah, and I don't see how we could get to @wolfgangwalther's work without doing something like this at least for the interim. The goal here is to move packages in nixpkgs off of using |
And I fully agree with that goal. I just think we should use allowAliases, not introduce allowVariants. |
|
I've explained that that isn't really optimal since it's not really an alias, it'll break existing things if people turned aliases off, and if someone wants it for CI then every throw in aliases will show up. |
|
I understand your position, because you don't want any breaking changes for existing use-cases. My position is different, because I am not only OK with breaking changes, in small steps - in this case, I actively want them. If we ever want to get away from those variants, we must break them eventually. This seems like a reasonable first step. |
|
Can we do |
As said earlier, I'm not a big fan of introducing it now, if we already have the intent to remove it again. But to be clear: I am not blocking this PR, otherwise I would have "Requested Changes". So if the three of you agree with the current approach (and it looks like this, given the two approvals), then you might still want to go ahead with it in this form. I think I have voiced all my concerns :D |
That's been my plan.
Sounds good. |
|
@RossComputerGuy Can you add modify the docs to say we expect |
|
After work I can, about 8 hours from now. Unless someone is able to do it sooner. |
Just now getting to this, I don't think 25.11 would remove it based on this:
Would it be better to note that it is likely to be dropped after 26.05? Of course it could be removed after 25.11 but it really depends on the pace of how we can get things through. |
|
Just leave it vague and say it will be removed in a future stable release. |
|
Done in #409265 |
|
@RossComputerGuy uh is that the PR you meant to link? |
|
No apparently the PR didn't get created even though I remember making it, it should be #409484 |
|
As per @Ericson2314's request (#409484 (comment)), we're backporting this to 25.05 |
|
Successfully created backport PR for |
| variants = import ./variants.nix { | ||
| inherit | ||
| lib | ||
| nixpkgsFun | ||
| stdenv | ||
| overlays | ||
| makeMuslParsedPlatform | ||
| ; | ||
| }; |
There was a problem hiding this comment.
So we now have an allowVariants config option - but it doesn't do anything. Its value is not used anywhere. All the variants are still available when setting it to false.
What was the intent to introduce this again, when apparently nobody has used it, yet?
There was a problem hiding this comment.
The plan is to set it to true in CI once we have a competent replacement. #410056 is one that I've worked on. We're kinda blocked on that with GCC NG, @Ericson2314 and I are working on it.
There was a problem hiding this comment.
The plan is to set it to true in CI
I think this is just a typo and you mean false.
I think you missed my point: When I use allowVariants = false, then it doesn't work. It doesn't do anything. The PR body mentions this:
Also add mkOptionalOverlay, this allows us to throw an error when an attribute from an overlay isn't available unless enabled.
But apparently this has been lost during later refactors of the PR. Now all variants are unconditionally included all the time.
We currently have a prominently placed release note (including a backport) which mentions that we have a new config option allowVariants, but this config option is disfunctional.
I hope that clarifies it.
There was a problem hiding this comment.
I think this is just a typo and you mean
false.
Yes, I meant false. It was a typo.
I think you missed my point: When I use
allowVariants = false, then it doesn't work. It doesn't do anything. The PR body mentions this:Also add mkOptionalOverlay, this allows us to throw an error when an attribute from an overlay isn't available unless enabled.
But apparently this has been lost during later refactors of the PR. Now all variants are unconditionally included all the time.
mkOptionalOverlay was removed due to a review.
We currently have a prominently placed release note (including a backport) which mentions that we have a new config option
allowVariants, but this config option is disfunctional.I hope that clarifies it.
Huh, lemme check if this works. I remember testing it and it did work.
There was a problem hiding this comment.
It's easy to confirm that it can't work. Just grep for allowVariants. It's only used in top-level/config and the release notes :)
There was a problem hiding this comment.
Oh now I see what's going on, after #400351 (comment) I didn't add in lib.optionalAttrs for the variants attribute in pkgs/top-level/stage.nix.
Things done
Idea comes from #375435 (comment).
Add separate nixpkgs variants which can be disabled or enabled as needed.
Also add
mkOptionalOverlay, this allows us to throw an error when an attribute from an overlay isn't available unless enabled.nix.conf? (See Nix manual)sandbox = relaxedsandbox = truenix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)Add a 👍 reaction to pull requests you find important.