about summary refs log tree commit diff
path: root/pkgs/stdenv
diff options
context:
space:
mode:
authorLinus Heckemann <git@sphalerite.org>2022-04-05 12:18:04 +0200
committerLinus Heckemann <git@sphalerite.org>2022-04-05 12:20:38 +0200
commit235fe92e4268dfeb681dcb07273b152579592ea4 (patch)
treea6727bdc2113d4d30004771846c03d88e3c8a623 /pkgs/stdenv
parentdbdacbca8eb109967ffc9ee1f4ae9f4a41be8c67 (diff)
make-derivation: allow nested lists in buildInputs
This isn't really desirable in general, but given that Nix itself
currently relies on this behaviour and that we don't want to break
backwards compatibility we should support it for now, maybe
deprecating it in the future.
Diffstat (limited to 'pkgs/stdenv')
-rw-r--r--pkgs/stdenv/generic/make-derivation.nix6
1 files changed, 4 insertions, 2 deletions
diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix
index 6bd31de83df51..eb4f7e59490a3 100644
--- a/pkgs/stdenv/generic/make-derivation.nix
+++ b/pkgs/stdenv/generic/make-derivation.nix
@@ -129,9 +129,11 @@ let
   # hardeningDisable additionally supports "all".
   erroneousHardeningFlags = lib.subtractLists supportedHardeningFlags (hardeningEnable ++ lib.remove "all" hardeningDisable);
 
-  checkDependencyList = name: deps: lib.flip lib.imap1 deps (index: dep:
+  checkDependencyList = checkDependencyList' [];
+  checkDependencyList' = positions: name: deps: lib.flip lib.imap1 deps (index: dep:
     if lib.isDerivation dep || isNull dep || builtins.typeOf dep == "path" then dep
-    else throw "Dependency is not of a valid type: element ${toString index} of ${name} for ${attrs.name or attrs.pname}");
+    else if lib.isList dep then checkDependencyList' ([index] ++ positions) name dep
+    else throw "Dependency is not of a valid type: ${lib.concatMapStrings (ix: "element ${toString ix} of ") ([index] ++ positions)}${name} for ${attrs.name or attrs.pname}");
 in if builtins.length erroneousHardeningFlags != 0
 then abort ("mkDerivation was called with unsupported hardening flags: " + lib.generators.toPretty {} {
   inherit erroneousHardeningFlags hardeningDisable hardeningEnable supportedHardeningFlags;