From c2b1ca029663d1ad41bbffd3d09becada06c74cc Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Fri, 3 May 2013 09:09:58 -0400 Subject: [PATCH] Revert "Revert "overrideDerivation: Simplify"" Now that `drv.passthru' actually is meaningful, this works. This reverts commit d21bfddc57cdbc6c9a878dc364ffefbfc4455488. Signed-off-by: Shea Levy --- pkgs/lib/customisation.nix | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/pkgs/lib/customisation.nix b/pkgs/lib/customisation.nix index a35b44e9f6ee..50816f99ec60 100644 --- a/pkgs/lib/customisation.nix +++ b/pkgs/lib/customisation.nix @@ -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;