buildEnv: fix #14682 evaluation in some edge cases

I supplied meta.outputsToInstall automatically in all
mkDerivation products, but some packages still don't use it.
The reported case: jekyll -> bundlerEnv -> buildEnv -> runCommand.
This commit is contained in:
Vladimír Čunát 2016-04-17 08:53:14 +02:00
parent a832a71c2c
commit f57c6449dc

View file

@ -49,8 +49,11 @@ runCommand name
pkgs = builtins.toJSON (map (drv: {
paths =
# First add the usual output(s): respect if user has chosen explicitly,
# and otherwise use `meta.outputsToInstall` (guaranteed to exist by stdenv).
(if (drv.outputUnspecified or false)
# and otherwise use `meta.outputsToInstall`. The attribute is guaranteed
# to exist in mkDerivation-created cases. The other cases (e.g. runCommand)
# aren't expected to have multiple outputs.
(if drv.outputUnspecified or false
&& drv.meta.outputsToInstall or null != null
then map (outName: drv.${outName}) drv.meta.outputsToInstall
else [ drv ])
# Add any extra outputs specified by the caller of `buildEnv`.