summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorVladimír Čunát <v@cunat.cz>2020-03-12 09:41:12 +0100
committerVladimír Čunát <v@cunat.cz>2020-03-12 09:41:12 +0100
commit4d543ca04833e56bc21acdec9cd0939eed71d590 (patch)
tree19bee02358f033964e4e19ef8591c9b7b27105bd /lib
parentfd04c3afbbd6dee3d2ac68c074ac58c9d62b2bb8 (diff)
parentb63f684b3d0b2e3d904ccc6348718adc7c6f93d4 (diff)
downloadnixpkgs-4d543ca04833e56bc21acdec9cd0939eed71d590.tar
nixpkgs-4d543ca04833e56bc21acdec9cd0939eed71d590.tar.gz
nixpkgs-4d543ca04833e56bc21acdec9cd0939eed71d590.tar.bz2
nixpkgs-4d543ca04833e56bc21acdec9cd0939eed71d590.tar.lz
nixpkgs-4d543ca04833e56bc21acdec9cd0939eed71d590.tar.xz
nixpkgs-4d543ca04833e56bc21acdec9cd0939eed71d590.tar.zst
nixpkgs-4d543ca04833e56bc21acdec9cd0939eed71d590.zip
Merge #81713: lib.callPackages(With): guard against a repeated mistake
Diffstat (limited to 'lib')
-rw-r--r--lib/customisation.nix7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/customisation.nix b/lib/customisation.nix
index ac234e3b8c6..dc5dd769197 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 "<unknown-name>"}";''
+          + " did you mean to use `callPackage` instead?")
+      else lib.mapAttrs mkAttrOverridable pkgs;
 
 
   /* Add attributes to each output of a derivation without changing