From 235fe92e4268dfeb681dcb07273b152579592ea4 Mon Sep 17 00:00:00 2001 From: Linus Heckemann Date: Tue, 5 Apr 2022 12:18:04 +0200 Subject: [PATCH] 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. --- pkgs/stdenv/generic/make-derivation.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index 6bd31de83df5..eb4f7e59490a 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;