mkDerivation: make allowedReference/allowedRequisites nullable when __structuredAttrs is true#462141
Conversation
8164203 to
b803d30
Compare
|
|
Why would I set these to |
These two variables are the whitelists. |
| raw = zipAttrsWith (_: builtins.concatLists) [ | ||
| (makeOutputChecks attrs) | ||
| attrsOutputChecksFiltered | ||
| (makeOutputChecks attrs.outputChecks.${name} or { }) | ||
| ]; |
There was a problem hiding this comment.
I'm trying to imagine when setting allowedRe... = null is useful - and I think it only makes sense when overriding attrs, right?
But consider this:
mkDerivation {
__structuredAttrs = true;
outputChecks.allowedRequisites = [ foo ];
}When overriding this with allowedRequisites = null;, it will not have the intended effect - foo will still be in there.
When overriding attrs of a structuredAttrs-enabled derivation, then you just need to override outputChecks.... and not the non-structured-attrs variant.
We only have this compatibility hack to be able to create derivations that don't specify __structuredAttrs at all, i.e. rely on the default, and will then still work when flipping the default later.
I think we don't need to support overrideAttrs for this thing - it's discouraged from using inside Nixpkgs anyway.
There was a problem hiding this comment.
If there is a package with { allowedRequisites = [ ... ]; }, and I want to override it so to be { __structuredAttrs = true; }; it would then be helpful to cancel the top-level allowedRequisites with null.
…__structuredAttrs is true
b803d30 to
eddb12a
Compare
stdenv.mkDerivation { allowedRequisites = null; }should work whether__structuredAttrsisfalseortrue.Things done
passthru.tests.nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.Add a 👍 reaction to pull requests you find important.