From b63f684b3d0b2e3d904ccc6348718adc7c6f93d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Wed, 4 Mar 2020 11:58:03 +0100 Subject: [PATCH] lib.callPackages(With): guard against a repeated mistake For example see the parent commit. --- lib/customisation.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/customisation.nix b/lib/customisation.nix index ac234e3b8c6f..dc5dd7691976 100644 --- a/lib/customisation.nix +++ b/lib/customisation.nix @@ -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 ""}";'' + + " did you mean to use `callPackage` instead?") + else lib.mapAttrs mkAttrOverridable pkgs; /* Add attributes to each output of a derivation without changing