Revert "overrideDerivation: Simplify"

This reverts commit 6640000cb7, 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
This commit is contained in:
Eelco Dolstra 2013-05-03 11:46:49 +02:00
parent 7b868bbff4
commit d21bfddc57

View file

@ -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;