allow derivation attributes in env

derivations can be coerced to their output paths
This commit is contained in:
Artturin 2022-12-07 00:08:33 +02:00
parent 8ad0103a34
commit 734d7df235
3 changed files with 20 additions and 17 deletions

View File

@ -103,15 +103,12 @@ stdenv.mkDerivation {
preferLocalBuild = true;
inherit bintools_bin libc_bin libc_dev libc_lib coreutils_bin;
shell = getBin shell + shell.shellPath or "";
gnugrep_bin = if nativeTools then "" else gnugrep;
inherit targetPrefix suffixSalt;
inherit bintools_bin libc_bin libc_dev libc_lib;
outputs = [ "out" ] ++ optionals propagateDoc ([ "man" ] ++ optional (bintools ? info) "info");
passthru = {
inherit targetPrefix suffixSalt;
inherit bintools libc nativeTools nativeLibc nativePrefix;
emacsBufferSetup = pkgs: ''
@ -366,10 +363,13 @@ stdenv.mkDerivation {
##
+ extraBuildCommands;
inherit dynamicLinker;
# for substitution in utils.bash
expandResponseParams = "${expand-response-params}/bin/expand-response-params";
env = {
# for substitution in utils.bash
expandResponseParams = "${expand-response-params}/bin/expand-response-params";
shell = getBin shell + shell.shellPath or "";
gnugrep_bin = if nativeTools then "" else gnugrep;
inherit dynamicLinker suffixSalt coreutils_bin;
};
meta =
let bintools_ = if bintools != null then bintools else {}; in

View File

@ -131,16 +131,14 @@ stdenv.mkDerivation {
preferLocalBuild = true;
inherit cc libc_bin libc_dev libc_lib bintools coreutils_bin;
shell = getBin shell + shell.shellPath or "";
gnugrep_bin = if nativeTools then "" else gnugrep;
inherit cc libc_bin libc_dev libc_lib;
inherit targetPrefix suffixSalt;
inherit darwinPlatformForCC darwinMinVersion darwinMinVersionVariable;
outputs = [ "out" ] ++ optionals propagateDoc [ "man" "info" ];
passthru = {
inherit targetPrefix suffixSalt;
# "cc" is the generic name for a C compiler, but there is no one for package
# providing the linker and related tools. The two we use now are GNU
# Binutils, and Apple's "cctools"; "bintools" as an attempt to find an
@ -538,8 +536,13 @@ stdenv.mkDerivation {
nixSupport);
# for substitution in utils.bash
expandResponseParams = "${expand-response-params}/bin/expand-response-params";
env = {
# for substitution in utils.bash
expandResponseParams = "${expand-response-params}/bin/expand-response-params";
shell = getBin shell + shell.shellPath or "";
gnugrep_bin = if nativeTools then "" else gnugrep;
inherit suffixSalt coreutils_bin bintools;
};
meta =
let cc_ = if cc != null then cc else {}; in

View File

@ -488,8 +488,8 @@ else let
assert lib.assertMsg (overlappingNames == [ ])
"The env attribute set cannot contain any attributes passed to derivation. The following attributes are overlapping: ${lib.concatStringsSep ", " overlappingNames}";
lib.mapAttrs
(n: v: assert lib.assertMsg (lib.isString v || lib.isBool v || lib.isInt v)
"The env attribute set can only contain string, boolean or integer attributes. The ${n} attribute is of type ${builtins.typeOf v}."; v)
(n: v: assert lib.assertMsg (lib.isString v || lib.isBool v || lib.isInt v || lib.isDerivation v)
"The env attribute set can only contain derivation, string, boolean or integer attributes. The ${n} attribute is of type ${builtins.typeOf v}."; v)
env;
in