summary refs log tree commit diff
diff options
context:
space:
mode:
authorGerg-L <GregLeyda@proton.me>2023-10-13 20:45:19 -0400
committerGerg-L <GregLeyda@proton.me>2023-10-16 18:52:56 -0400
commitd7c49ca7152768114a9359b729557f77b8343545 (patch)
tree66b68bad065e6aa571769edb14a1ff45e936bd3d
parent959de2cf8ba59f63cee90216e579cf1de8b94610 (diff)
downloadnixpkgs-d7c49ca7152768114a9359b729557f77b8343545.tar
nixpkgs-d7c49ca7152768114a9359b729557f77b8343545.tar.gz
nixpkgs-d7c49ca7152768114a9359b729557f77b8343545.tar.bz2
nixpkgs-d7c49ca7152768114a9359b729557f77b8343545.tar.lz
nixpkgs-d7c49ca7152768114a9359b729557f77b8343545.tar.xz
nixpkgs-d7c49ca7152768114a9359b729557f77b8343545.tar.zst
nixpkgs-d7c49ca7152768114a9359b729557f77b8343545.zip
lib.getExe': check arguments
-rw-r--r--lib/meta.nix9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/meta.nix b/lib/meta.nix
index 44730a71551..2e817c42327 100644
--- a/lib/meta.nix
+++ b/lib/meta.nix
@@ -162,5 +162,12 @@ rec {
        getExe' pkgs.imagemagick "convert"
        => "/nix/store/5rs48jamq7k6sal98ymj9l4k2bnwq515-imagemagick-7.1.1-15/bin/convert"
   */
-  getExe' = x: y: "${lib.getBin x}/bin/${y}";
+  getExe' = x: y:
+    assert lib.assertMsg (lib.isDerivation x)
+      "lib.meta.getExe': The first argument is of type ${builtins.typeOf x}, but it should be a derivation instead.";
+    assert lib.assertMsg (lib.isString y)
+     "lib.meta.getExe': The second argument is of type ${builtins.typeOf y}, but it should be a string instead.";
+    assert lib.assertMsg (builtins.length (lib.splitString "/" y) == 1)
+     "lib.meta.getExe': The second argument \"${y}\" is a nested path with a \"/\" character, but it should just be the name of the executable instead.";
+    "${lib.getBin x}/bin/${y}";
 }