stdenv.mkDerivation: Add meta and passthru to all outputs.
Before, only the first output (and not even that when accessed through 'all' or its corresponding attribtue) had meta information and the relevant passthru attributes. This doesn't change stdenv's hash and the tarball still builds, I'm pretty sure this is safe for master.
This commit is contained in:
parent
b90b62e33b
commit
0a7d8a5175
|
@ -44,7 +44,8 @@ let
|
|||
if !allowUnfree && (let l = attrs.meta.license or ""; in l == "unfree" || l == "unfree-redistributable" || l == lib.licenses.proprietary) then
|
||||
throw "package ‘${attrs.name}’ has an unfree license, refusing to evaluate"
|
||||
else
|
||||
(derivation (
|
||||
let
|
||||
drv = derivation (
|
||||
(removeAttrs attrs ["meta" "passthru" "crossAttrs"])
|
||||
// (let
|
||||
buildInputs = attrs.buildInputs or [];
|
||||
|
@ -68,18 +69,33 @@ let
|
|||
(crossConfig == null) buildInputs;
|
||||
propagatedBuildNativeInputs = propagatedBuildNativeInputs ++
|
||||
lib.optionals (crossConfig == null) propagatedBuildInputs;
|
||||
}))
|
||||
)
|
||||
}));
|
||||
|
||||
outputs = drv.outputs or [ "out" ];
|
||||
|
||||
commonAttrs = drv // (builtins.listToAttrs outputsList) //
|
||||
({ all = map (x: x.value) outputsList;
|
||||
# The meta attribute is passed in the resulting attribute set,
|
||||
# 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
|
||||
# include it in the result, it *is* available to nix-env for
|
||||
# queries.
|
||||
// { meta = attrs.meta or {}; }
|
||||
meta = attrs.meta or {};
|
||||
}) //
|
||||
# Pass through extra attributes that are not inputs, but
|
||||
# should be made available to Nix expressions using the
|
||||
# derivation (e.g., in assertions).
|
||||
// (attrs.passthru or {});
|
||||
(attrs.passthru or {});
|
||||
|
||||
outputToAttrListElement = outputName:
|
||||
{ name = outputName;
|
||||
value = commonAttrs // {
|
||||
inherit (builtins.getAttr outputName drv) outPath drvPath type outputName;
|
||||
};
|
||||
};
|
||||
|
||||
outputsList = map outputToAttrListElement outputs;
|
||||
in (builtins.head outputsList).value;
|
||||
|
||||
# Utility flags to test the type of platform.
|
||||
isDarwin = result.system == "x86_64-darwin";
|
||||
|
|
Loading…
Reference in New Issue