mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-13 09:17:07 +03:00
top-level: Fix splicing, again
This commit is contained in:
parent
965cc5da57
commit
6c36d3c9e0
@ -37,26 +37,25 @@ let
|
|||||||
inherit name;
|
inherit name;
|
||||||
value = let
|
value = let
|
||||||
defaultValue = mash.${name};
|
defaultValue = mash.${name};
|
||||||
buildValue = buildPkgs.${name};
|
# `or {}` is for the non-derivation attsert splicing case, where `{}` is the identity.
|
||||||
runValue = runPkgs.${name};
|
buildValue = buildPkgs.${name} or {};
|
||||||
|
runValue = runPkgs.${name} or {};
|
||||||
augmentedValue = defaultValue
|
augmentedValue = defaultValue
|
||||||
// (lib.optionalAttrs (buildPkgs ? ${name}) { nativeDrv = buildValue; })
|
// (lib.optionalAttrs (buildPkgs ? ${name}) { nativeDrv = buildValue; })
|
||||||
// (lib.optionalAttrs (runPkgs ? ${name}) { crossDrv = runValue; });
|
// (lib.optionalAttrs (runPkgs ? ${name}) { crossDrv = runValue; });
|
||||||
# Get the set of outputs of a derivation
|
# Get the set of outputs of a derivation. If one derivation fails to
|
||||||
|
# evaluate we don't want to diverge the entire splice, so we fall back
|
||||||
|
# on {}
|
||||||
tryGetOutputs = value0: let
|
tryGetOutputs = value0: let
|
||||||
eval = builtins.tryEval value0;
|
inherit (builtins.tryEval value0) success value;
|
||||||
in getOutputs (if eval.success then eval.value else {});
|
in getOutputs (lib.optionalAttrs success value);
|
||||||
getOutputs = value: lib.genAttrs
|
getOutputs = value: lib.genAttrs
|
||||||
(value.outputs or (lib.optional (value ? out) "out"))
|
(value.outputs or (lib.optional (value ? out) "out"))
|
||||||
(output: value.${output});
|
(output: value.${output});
|
||||||
in
|
in
|
||||||
# Certain *Cross derivations will fail assertions, but we need their
|
|
||||||
# nativeDrv. We are assuming anything that fails to evaluate is an
|
|
||||||
# attrset (including derivation) and thus can be unioned.
|
|
||||||
if !(builtins.tryEval defaultValue).success then augmentedValue
|
|
||||||
# The derivation along with its outputs, which we recur
|
# The derivation along with its outputs, which we recur
|
||||||
# on to splice them together.
|
# on to splice them together.
|
||||||
else if lib.isDerivation defaultValue then augmentedValue
|
if lib.isDerivation defaultValue then augmentedValue
|
||||||
// splicer (tryGetOutputs buildValue) (getOutputs runValue)
|
// splicer (tryGetOutputs buildValue) (getOutputs runValue)
|
||||||
# Just recur on plain attrsets
|
# Just recur on plain attrsets
|
||||||
else if lib.isAttrs defaultValue then splicer buildValue runValue
|
else if lib.isAttrs defaultValue then splicer buildValue runValue
|
||||||
|
Loading…
Reference in New Issue
Block a user