stdenv.mkDerivation: move attrNames out of happy path
This commit is contained in:
@@ -26,6 +26,7 @@ let
|
||||
getDev
|
||||
head
|
||||
foldl'
|
||||
intersectAttrs
|
||||
isAttrs
|
||||
isBool
|
||||
isDerivation
|
||||
@@ -909,13 +910,13 @@ let
|
||||
|
||||
checkedEnv =
|
||||
let
|
||||
overlappingNames = attrNames (builtins.intersectAttrs env' derivationArg);
|
||||
overlappingArgs = intersectAttrs env' derivationArg;
|
||||
in
|
||||
assert
|
||||
(isAttrs env && !isDerivation env)
|
||||
|| throw "`env` must be an attribute set of environment variables. Set `env.env` or pick a more specific name.";
|
||||
assert
|
||||
(overlappingNames == [ ])
|
||||
(overlappingArgs == { })
|
||||
|| throw (
|
||||
let
|
||||
errors = lib.concatMapStringsSep "\n" (
|
||||
@@ -923,7 +924,7 @@ let
|
||||
" - ${name}: in `env`: ${lib.generators.toPretty { } env'.${name}}; in derivation arguments: ${
|
||||
lib.generators.toPretty { } derivationArg.${name}
|
||||
}"
|
||||
) overlappingNames;
|
||||
) (attrNames overlappingArgs);
|
||||
|
||||
in
|
||||
"The `env` attribute set cannot contain any attributes passed to derivation. The following attributes are overlapping:\n${errors}"
|
||||
|
||||
Reference in New Issue
Block a user