diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2013-03-07 19:33:52 +0100 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2013-03-07 19:33:52 +0100 |
commit | 674c51af3c0f3f1c65e1975893fdf6438bc57f28 (patch) | |
tree | 3020861cf515bc567e191361357d42e11ac817ee /pkgs/stdenv | |
parent | da437144fa4f446e91b5f7f78b55faa4d12de58a (diff) | |
parent | d742d26b0d8c7125fb29417fcb40e2665e10100d (diff) | |
download | nixlib-674c51af3c0f3f1c65e1975893fdf6438bc57f28.tar nixlib-674c51af3c0f3f1c65e1975893fdf6438bc57f28.tar.gz nixlib-674c51af3c0f3f1c65e1975893fdf6438bc57f28.tar.bz2 nixlib-674c51af3c0f3f1c65e1975893fdf6438bc57f28.tar.lz nixlib-674c51af3c0f3f1c65e1975893fdf6438bc57f28.tar.xz nixlib-674c51af3c0f3f1c65e1975893fdf6438bc57f28.tar.zst nixlib-674c51af3c0f3f1c65e1975893fdf6438bc57f28.zip |
Merge remote-tracking branch 'origin/master' into stdenv-updates
Diffstat (limited to 'pkgs/stdenv')
-rw-r--r-- | pkgs/stdenv/generic/default.nix | 90 |
1 files changed, 53 insertions, 37 deletions
diff --git a/pkgs/stdenv/generic/default.nix b/pkgs/stdenv/generic/default.nix index 6f5e5d34582f..26f410cee117 100644 --- a/pkgs/stdenv/generic/default.nix +++ b/pkgs/stdenv/generic/default.nix @@ -44,43 +44,59 @@ 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 ( - (removeAttrs attrs ["meta" "passthru" "crossAttrs"]) - // (let - buildInputs = attrs.buildInputs or []; - nativeBuildInputs = attrs.nativeBuildInputs or []; - propagatedBuildInputs = attrs.propagatedBuildInputs or []; - propagatedNativeBuildInputs = attrs.propagatedNativeBuildInputs or []; - crossConfig = attrs.crossConfig or null; - in - { - builder = attrs.realBuilder or shell; - args = attrs.args or ["-e" (attrs.builder or ./default-builder.sh)]; - stdenv = result; - system = result.system; - userHook = config.stdenv.userHook or null; - - # Inputs built by the cross compiler. - buildInputs = lib.optionals (crossConfig != null) buildInputs; - propagatedBuildInputs = lib.optionals (crossConfig != null) - propagatedBuildInputs; - # Inputs built by the usual native compiler. - nativeBuildInputs = nativeBuildInputs ++ lib.optionals - (crossConfig == null) buildInputs; - propagatedNativeBuildInputs = propagatedNativeBuildInputs ++ - lib.optionals (crossConfig == null) propagatedBuildInputs; - })) - ) - # 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 {}; } - # 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 {}); + let + drv = derivation ( + (removeAttrs attrs ["meta" "passthru" "crossAttrs"]) + // (let + buildInputs = attrs.buildInputs or []; + nativeBuildInputs = attrs.nativeBuildInputs or []; + propagatedBuildInputs = attrs.propagatedBuildInputs or []; + propagatedNativeBuildInputs = attrs.propagatedNativeBuildInputs or []; + crossConfig = attrs.crossConfig or null; + in + { + builder = attrs.realBuilder or shell; + args = attrs.args or ["-e" (attrs.builder or ./default-builder.sh)]; + stdenv = result; + system = result.system; + userHook = config.stdenv.userHook or null; + + # Inputs built by the cross compiler. + buildInputs = lib.optionals (crossConfig != null) buildInputs; + propagatedBuildInputs = lib.optionals (crossConfig != null) + propagatedBuildInputs; + # Inputs built by the usual native compiler. + nativeBuildInputs = nativeBuildInputs ++ lib.optionals + (crossConfig == null) buildInputs; + propagatedNativeBuildInputs = propagatedNativeBuildInputs ++ + 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 {}; + }) // + # 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 {}); + + 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"; |