lib.customisation: add getFinalPassthruWith for unified missing finalAttrs.passthru.<attr> handling#446760
lib.customisation: add getFinalPassthruWith for unified missing finalAttrs.passthru.<attr> handling#446760ShamrockLee wants to merge 3 commits intoNixOS:masterfrom
getFinalPassthruWith for unified missing finalAttrs.passthru.<attr> handling#446760Conversation
364dbf5 to
d2d22c3
Compare
|
d2d22c3 to
9ffbc0e
Compare
|
I added some test cases. |
9ffbc0e to
c12fddf
Compare
c12fddf to
bf28391
Compare
getFinalPassthruWith and getFinalPassthruMissingMessage for unified missing finalPassthru.<attr> handlinggetFinalPassthruWith for unified missing finalPassthru.<attr> handling
getFinalPassthruWith for unified missing finalPassthru.<attr> handlinggetFinalPassthruWith for unified missing finalAttrs.passthru.<attr> handling
|
Due to the SC election, I haven't had a chance to look at this. |
No hurry. This kind of interface design takes time to gather broader inputs and consensus. We might also update the fixed-point arguments documentation afterward. In addition, backporting this function and substituting existing warning/throwing causes no rebuilds. |
|
I have not looked at this our thought about this in-depth, but my gut tells me this is overly specific to be put in |
This is a very valid point. this function is tightly coupled to the Should we move it under Still, considering the existence of |
The alternative, in my mind, is to put it next to |
Following the increased adoption of fixed-point attributes (
finalAttrs: { }) and<pkg>.overrideAttrs-based overriding, some arguments are referenced and overridden underfinalAttrs.passthru, accidental overriting/emptying of thepassthruattributes could result in surprising errors/behavioural changes that is hard to identify and debug.This PR provides two new Nixpkgs Library functions,
getFinalPassthruWithandgetFinalPassthruMissingMessage, which gets the attribute fromfinalAttrs.passthruand fall back to specified behaviours with informative error/warning message including the possible position of the lastpassthruoverriding.See the followings for context:
Aside from
buildGoModule, recentbuildPythonPackageoverriding improvement will also benefit from this library function.Questions:
lib.metainstead oflib.customisation?getFinalPassthruWithhas a signature of{ handler, prefix, finalAttrs } -> attrName -> Anyinstead of{ handler, prefix } -> finalAttrs -> attrName -> Any?Things done
passthru.tests.nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.Add a 👍 reaction to pull requests you find important.