From d21bfddc57cdbc6c9a878dc364ffefbfc4455488 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 3 May 2013 11:46:49 +0200 Subject: [PATCH] Revert "overrideDerivation: Simplify" This reverts commit 6640000cb7148ba39bbdcca8e0cd7f5c224bce57, which caused passthru attributes not to be passed correctly after calling overrideDerivation. E.g. in the evaluation of the Nix jobset: at `deb_ubuntu1004i386' [officialRelease = false, nix = ...]: attribute `fullName' missing --- pkgs/lib/customisation.nix | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pkgs/lib/customisation.nix b/pkgs/lib/customisation.nix index 50816f99ec6..a35b44e9f6e 100644 --- a/pkgs/lib/customisation.nix +++ b/pkgs/lib/customisation.nix @@ -33,14 +33,17 @@ rec { overrideDerivation = drv: f: let - newDrv = derivation (drv.drvAttrs // (f drv)); + # 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)); in newDrv // - { meta = drv.meta or {}; + { meta = if drv ? meta then drv.meta else {}; passthru = if drv ? passthru then drv.passthru else {}; } // - (drv.passthru or {}) - // (if (drv ? crossDrv && drv ? nativeDrv) then { crossDrv = overrideDerivation drv.crossDrv f;