lib.callPackages(With): guard against a repeated mistake

For example see the parent commit.
This commit is contained in:
Vladimír Čunát 2020-03-04 11:58:03 +01:00
parent fbe3eb29dd
commit b63f684b3d
No known key found for this signature in database
GPG Key ID: E747DF1F9575A3AA

View File

@ -131,7 +131,12 @@ rec {
origArgs = auto // args;
pkgs = f origArgs;
mkAttrOverridable = name: _: makeOverridable (newArgs: (f newArgs).${name}) origArgs;
in lib.mapAttrs mkAttrOverridable pkgs;
in
if lib.isDerivation pkgs then throw
("function `callPackages` was called on a *single* derivation "
+ ''"${pkgs.name or "<unknown-name>"}";''
+ " did you mean to use `callPackage` instead?")
else lib.mapAttrs mkAttrOverridable pkgs;
/* Add attributes to each output of a derivation without changing