summary refs log tree commit diff
path: root/lib/customisation.nix
diff options
context:
space:
mode:
authorVladimír Čunát <v@cunat.cz>2020-03-04 11:58:03 +0100
committerVladimír Čunát <v@cunat.cz>2020-03-12 09:40:15 +0100
commitb63f684b3d0b2e3d904ccc6348718adc7c6f93d4 (patch)
tree103846703325184f674ede902ae69e7c7635901b /lib/customisation.nix
parentfbe3eb29dd1989dd05bbd86b425ba7cdaf6cbb8b (diff)
downloadnixpkgs-b63f684b3d0b2e3d904ccc6348718adc7c6f93d4.tar
nixpkgs-b63f684b3d0b2e3d904ccc6348718adc7c6f93d4.tar.gz
nixpkgs-b63f684b3d0b2e3d904ccc6348718adc7c6f93d4.tar.bz2
nixpkgs-b63f684b3d0b2e3d904ccc6348718adc7c6f93d4.tar.lz
nixpkgs-b63f684b3d0b2e3d904ccc6348718adc7c6f93d4.tar.xz
nixpkgs-b63f684b3d0b2e3d904ccc6348718adc7c6f93d4.tar.zst
nixpkgs-b63f684b3d0b2e3d904ccc6348718adc7c6f93d4.zip
lib.callPackages(With): guard against a repeated mistake
For example see the parent commit.
Diffstat (limited to 'lib/customisation.nix')
-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