versionCheckHook: Default versionCheckProgram to mainProgram#412768
versionCheckHook: Default versionCheckProgram to mainProgram#412768philiptaron merged 5 commits intoNixOS:stagingfrom
versionCheckProgram to mainProgram#412768Conversation
efa5bab to
258f27f
Compare
philiptaron
left a comment
There was a problem hiding this comment.
I'm amenable to this change.
I see you've marked the PR as draft.
- What do you think the path to making it ready for review is?
- What do we need to do before merging it?
- Does anyone think we shouldn't do this?
- If we don't do this, what are some other options?
|
@philiptaron thanks for taking the time to review!
|
258f27f to
fd442d3
Compare
|
Merged #413663. |
fd442d3 to
e53fdd3
Compare
|
I just spotted this for the first time in a build and find the behaviour of this really confusing. I'm not a fan of introducing a new environment variable with questionable semantics: overriding a I'm tempted to revert before this can make it out into a release. |
|
FWIW, though I think it is correct that changing a package’s So I think the weakening of the property here is more benign than it may appear. This might be more an argument for lifting (There are also clearly metadata‐ish things like |
The fact that
I think your point only makes sense in isolation. |
I personally think it’s surprising that we’d not be okay with At the same time, clearly a |
This is also not great, but at least it does what it says on the tin.
Great plan that moves the option to where it actually makes semantic sense. |
|
Also |
|
Yeah, but without this PR, getting rid of the |
|
Successfully created backport PR for |
|
Without this, versionCheckHook is not respecting meta.mainProgram and thus leading to build failure in #454223 (comment) Requesting a backport. |
Exactly this. This is causing tons of rebuilds in my downstream project. I really think it is a step in the wrong direction and it breaks downstream users in a terrible way. |
Should probably have been the first choice (if I understand you: start deprecating |
|
#430810 is there for people to pick up if they would like to move to |
|
This change introduces redundant derivations for certain packages, specifically those differing only in their nixpkgs/pkgs/top-level/all-packages.nix Lines 3322 to 3327 in 83e544a nixpkgs/pkgs/top-level/all-packages.nix Line 8950 in 83e544a nixpkgs/pkgs/by-name/sb/sbom4files/package.nix Lines 5 to 7 in 83e544a The problem with patterns like |
|
@azuwis I think your example shows that EDIT: Ah, I was mistaken, there's no |
It failed to build caused by NixOS/nixpkgs#412768
lib.getExeprefers to usemeta.mainProgramoverpname. Not settingmeta.mainProgramleads tolib.getExeemitting a warning, stating that this "behavior is deprecated, because it leads to surprising errors when the assumption does not hold."nixpkgs/pkgs/by-name/ve/versionCheckHook/hook.sh
Line 29 in e78d238
The above snippet shows that when
versionCheckProgramis not set,versionCheckHookwill simply select the package'spnameand ignore themeta.mainProgramentry, which is counter-intuitive, and exhibits precisely the behaviour thatlib.getExedescribes as "deprecated".To remedy this, this PR introduces a new environment variable called
NIX_MAIN_PROGRAM, which derives its value from themeta.mainProgram.With the newly introduced
NIX_MAIN_PROGRAM,versionCheckHookprefersmeta.mainProgramoverpname, but fallbacks to the latter when the former is omitted.This PR was tested by adding a temporary opt-in flag in
make-derivation.nix(credits go to @emilazy for this cool trick!), opting in to this behaviour in thehellopackage, and changing itspnamevalue to something nonsensical, but the package still builds. Attempting this on the master branch causes the package to fail, despitemeta.mainProgrambeing set tohello.(click to open) @LordGrimmauld contributed this script to detect potential package breakage
When run against d313d94, it outputs
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.