stdenv: refactor (no change in semantics)
This just moves some expressions around in preparation to further changes.
This commit is contained in:
parent
74f55017d2
commit
7fdf18e892
@ -290,15 +290,15 @@ let
|
|||||||
in [ nativeBuildInputs buildInputs ];
|
in [ nativeBuildInputs buildInputs ];
|
||||||
|
|
||||||
propagatedDependencies' = map lib.chooseDevOutputs propagatedDependencies;
|
propagatedDependencies' = map lib.chooseDevOutputs propagatedDependencies;
|
||||||
in
|
|
||||||
|
|
||||||
# Throw an error if trying to evaluate an non-valid derivation
|
# Throw an error if trying to evaluate an non-valid derivation
|
||||||
assert let v = checkValidity attrs;
|
validityCondition =
|
||||||
|
let v = checkValidity attrs;
|
||||||
in if !v.valid
|
in if !v.valid
|
||||||
then throwEvalHelp (removeAttrs v ["valid"])
|
then throwEvalHelp (removeAttrs v ["valid"])
|
||||||
else true;
|
else true;
|
||||||
|
|
||||||
lib.addPassthru (derivation (
|
derivationArg =
|
||||||
(removeAttrs attrs
|
(removeAttrs attrs
|
||||||
["meta" "passthru" "crossAttrs" "pos"
|
["meta" "passthru" "crossAttrs" "pos"
|
||||||
"__impureHostDeps" "__propagatedImpureHostDeps"
|
"__impureHostDeps" "__propagatedImpureHostDeps"
|
||||||
@ -343,37 +343,44 @@ let
|
|||||||
__propagatedImpureHostDeps = computedPropagatedImpureHostDeps ++ __propagatedImpureHostDeps;
|
__propagatedImpureHostDeps = computedPropagatedImpureHostDeps ++ __propagatedImpureHostDeps;
|
||||||
} // (if outputs' != [ "out" ] then {
|
} // (if outputs' != [ "out" ] then {
|
||||||
outputs = outputs';
|
outputs = outputs';
|
||||||
} else { })))) (
|
} else { }));
|
||||||
{
|
|
||||||
overrideAttrs = f: mkDerivation (attrs // (f attrs));
|
# The meta attribute is passed in the resulting attribute set,
|
||||||
# The meta attribute is passed in the resulting attribute set,
|
# but it's not part of the actual derivation, i.e., it's not
|
||||||
# but it's not part of the actual derivation, i.e., it's not
|
# passed to the builder and is not a dependency. But since we
|
||||||
# passed to the builder and is not a dependency. But since we
|
# include it in the result, it *is* available to nix-env for queries.
|
||||||
# include it in the result, it *is* available to nix-env for queries.
|
meta = { }
|
||||||
meta = { }
|
# If the packager hasn't specified `outputsToInstall`, choose a default,
|
||||||
# If the packager hasn't specified `outputsToInstall`, choose a default,
|
# which is the name of `p.bin or p.out or p`;
|
||||||
# which is the name of `p.bin or p.out or p`;
|
# if he has specified it, it will be overridden below in `// meta`.
|
||||||
# if he has specified it, it will be overridden below in `// meta`.
|
# Note: This default probably shouldn't be globally configurable.
|
||||||
# Note: This default probably shouldn't be globally configurable.
|
# Services and users should specify outputs explicitly,
|
||||||
# Services and users should specify outputs explicitly,
|
# unless they are comfortable with this default.
|
||||||
# unless they are comfortable with this default.
|
// { outputsToInstall =
|
||||||
// { outputsToInstall =
|
let
|
||||||
let
|
outs = outputs'; # the value passed to derivation primitive
|
||||||
outs = outputs'; # the value passed to derivation primitive
|
hasOutput = out: builtins.elem out outs;
|
||||||
hasOutput = out: builtins.elem out outs;
|
in [( lib.findFirst hasOutput null (["bin" "out"] ++ outs) )];
|
||||||
in [( lib.findFirst hasOutput null (["bin" "out"] ++ outs) )];
|
}
|
||||||
}
|
// attrs.meta or {}
|
||||||
// meta
|
# Fill `meta.position` to identify the source location of the package.
|
||||||
# Fill `meta.position` to identify the source location of the package.
|
// lib.optionalAttrs (pos' != null)
|
||||||
// lib.optionalAttrs (pos' != null)
|
{ position = pos'.file + ":" + toString pos'.line; }
|
||||||
{ position = pos'.file + ":" + toString pos'.line; }
|
;
|
||||||
;
|
|
||||||
inherit passthru;
|
in
|
||||||
} //
|
|
||||||
# Pass through extra attributes that are not inputs, but
|
assert validityCondition;
|
||||||
# should be made available to Nix expressions using the
|
|
||||||
# derivation (e.g., in assertions).
|
lib.addPassthru (derivation derivationArg) (
|
||||||
passthru);
|
{
|
||||||
|
overrideAttrs = f: mkDerivation (attrs // (f attrs));
|
||||||
|
inherit meta passthru;
|
||||||
|
} //
|
||||||
|
# Pass through extra attributes that are not inputs, but
|
||||||
|
# should be made available to Nix expressions using the
|
||||||
|
# derivation (e.g., in assertions).
|
||||||
|
passthru);
|
||||||
|
|
||||||
# The stdenv that we are producing.
|
# The stdenv that we are producing.
|
||||||
result =
|
result =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user