Revert "Revert "Revert "overrideDerivation: Simplify"""
This reverts commit c2b1ca0296
.
It still breaks VM builds: http://hydra.nixos.org/build/4858140
This commit is contained in:
parent
18df66f466
commit
abf2d36773
1 changed files with 7 additions and 4 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue