-
-
Notifications
You must be signed in to change notification settings - Fork 14.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
Stdenv overhaul broken
flag
#140325
base: master
Are you sure you want to change the base?
Stdenv overhaul broken
flag
#140325
Conversation
This allows to override the `disabled` attribute with `overridePythonAttrs`.
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.
This! Thank you.
I really like this, but I'd like some more feedback because it seems potentially very impactful. Requesting review from lib.* codeowners, since this might be in their wheelhouse |
I realized another cool thing about this - consider a case where you have multiple independent causes for breakage: {
meta.broken = lib.optionalString enableA ''
feature A not supported!
'' + lib.optionalString enableB ''
feature B not supported!
'';
} This will tell you all the reasons a package is broken at the same time, nice!
No need to inspect a potentially complicated boolean expression to figure out why meta.broken is evaluating to |
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 think this is a positive change, but possibly the wrong direction. Specifically, I am a bit sceptical that this will lead to broken
being used in the wrong way, for the lack of a more appropriate alternative.
In my mind, broken
is meant to mark known compilation failures which should work, preventing users from wasting their time building something that's going to fail. Basically broken
says: This is a bug, pending resolution. For this use case a comment in the source is sufficient: The user is doing nothing wrong and someone is going to have to touch the nix expression in order to resolve the problem.
Especially given the Python change I've commented on below, I believe that this new feature will be (ab)used in order to show users that something they are trying to do is unsupported. In this case an error message is important, since the user is doing something they can not expect to work. We need a better mechanism here, since meta.platforms
and meta.badPlatforms
are extremely unexpressive (you can't even mark musl as unsupported via badPlatforms
because it only handles (full) platform tuples). However, I don't think that it's the best way forward to use broken
for this as well, since it carries the wrong implication: If a package can't be built with musl or clang, then it is not broken in this situation, since there is no reasonable way forward for us to fix this this situation.
Another concern I have here is the API change for meta.broken
, but I'm having a hard time gauging how impactful it'd be. I certainly have code that relies on broken
being a boolean. At the very least this would need an entry in the changelog and I think it'd be too rushed for 21.11 — we should give ourselves at least a release cycle to figure out any problem arising from this change, if it is made.
@@ -176,6 +170,7 @@ let | |||
# default to python's platforms | |||
platforms = python.meta.platforms; | |||
isBuildPythonPackage = python.meta.platforms; | |||
broken = lib.optionalString disabled "interpreter ${python.executable} is not supported by this version"; |
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.
This is not correct, Python packages are not broken — implying fixable — for a certain Python interpreter, but fundamentally don't support it and thus should never be able to be built with the wrong interpreter which would be possible via allowBroken
.
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.
agreed, that was carried on from the original patch, I can revert.
@sternenseemann I agree with your objection. What do you propose as a resolution? I was following this PR primarily due to #48663. I think the idea to overload |
I think there's three main distinct ways in which a package can be non-functioning:
The use case for Considering this, I propose this:
Doing it this way then makes it very clear which attribute should be used for what: Build errors can be put in Notably I'm also suggesting for these to be an attribute set, where the key should be used to indicate the type of error (and ideally we'd have a registry of error type keys). Doing it like this makes it very flexible for the future:
|
@infinisil what would you suggest we do with |
I'd say deprecate it |
I like what @infinisil suggests in #140325 (comment). |
I also think @infinisil's idea is good, mainly the notion of elevating build/run time errors to evaluation errors. Main objection: It is exactly one error that makes a package unusable. I think it would be an unnecessary complication to model multiple problems. I'm all for strong types, but since build errors are fundamentally people problems (someone has to investigate and fix code), it seems that distinguishing fixable from unfixable problems and presenting a string with some explanation should suffice. |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/packages-marked-as-broken-should-come-with-an-explanation/19187/8 |
@infinisil moving this forward sounds like a job for the Nixpkgs Architecture Team. |
Motivation for this change
This is a rebased version of #109407 because I would love to have this to present why luaPackages are not available (wrong interpreters) and for haskell packages where there are many broken packages: if we could save what's wrong in the broken field, I wouldn't have to attempt building the package to have an idea of what's wrong.
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)