1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-24 14:41:17 +00:00

Revert "Revert "overrideDerivation: Simplify""

Now that `drv.passthru' actually is meaningful, this works.

This reverts commit d21bfddc57.

Signed-off-by: Shea Levy <shea@shealevy.com>
This commit is contained in:
Shea Levy 2013-05-03 09:09:58 -04:00
parent 84fba68006
commit c2b1ca0296

View file

@ -33,17 +33,14 @@ rec {
overrideDerivation = drv: f:
let
# Filter out special attributes.
drop = [ "meta" "passthru" "outPath" "drvPath" "crossDrv" "nativeDrv" "type" "override" "deepOverride" "origArgs" "drvAttrs" "outputName" "all" "out" ]
# also drop functions such as .merge .override etc
++ lib.filter (n: isFunction (getAttr n drv)) (attrNames drv);
attrs = removeAttrs drv drop;
newDrv = derivation (attrs // (f drv));
newDrv = derivation (drv.drvAttrs // (f drv));
in newDrv //
{ meta = if drv ? meta then drv.meta else {};
{ meta = drv.meta or {};
passthru = if drv ? passthru then drv.passthru else {};
}
//
(drv.passthru or {})
//
(if (drv ? crossDrv && drv ? nativeDrv)
then {
crossDrv = overrideDerivation drv.crossDrv f;