-
-
Notifications
You must be signed in to change notification settings - Fork 17.1k
versionCheckHook: Default versionCheckProgram to mainProgram
#412768
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
Conversation
efa5bab to
258f27f
Compare
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 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
It failed to build caused by NixOS/nixpkgs#412768
|
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 |
Not-cherry-picked-because: #412768 was not backported.
|
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. |
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.