about summary refs log tree commit diff
path: root/pkgs/profpatsch
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2022-01-08 18:22:43 +0100
committerProfpatsch <mail@profpatsch.de>2022-01-08 19:56:58 +0100
commitf53c65286e66177d604462b63cb2e6c9cbbd6d8f (patch)
treef181e5b684d3bcd5b3857d5a42fd940194ea7faa /pkgs/profpatsch
parenta060f486b06af36688d792eebaa8f91cd32c156b (diff)
pkgs/profpatsch/nix-tools/nix-run-bin: use PATH instead
If you want to use multiple binaries (e.g. via `pkgs.symlinkJoin`),
this will work via PATH instead of magically tranforming the first
argument instead.
Diffstat (limited to 'pkgs/profpatsch')
-rw-r--r--pkgs/profpatsch/nix-tools.nix12
1 files changed, 4 insertions, 8 deletions
diff --git a/pkgs/profpatsch/nix-tools.nix b/pkgs/profpatsch/nix-tools.nix
index e0b20318..1f2ae89e 100644
--- a/pkgs/profpatsch/nix-tools.nix
+++ b/pkgs/profpatsch/nix-tools.nix
@@ -19,18 +19,14 @@ let
   #    nix-run-bin { -A foo <more_nix_options> } <foo_bin_name> args...
   #
   # Takes an execline block of `nix-build` arguments, which should produce a store path with a bin/ directory in it.
-  # Then runs the `/bin/<foo_bin_name>` executable in the store path with the given arguments.
+  # Then runs the given command line with the given arguments. All executables in the built storepath’s bin directory are prepended to `PATH`.
   nix-run-bin = writeExecline "nix-run-bin" { argMode = "env"; } [
-    "backtick" "-i" "storepath" [
+    "backtick" "-iE" "storepath" [
       runblock "1" bins.nix-build
     ]
+    "importas" "-ui" "PATH" "PATH"
+    "export" "PATH" "\${storepath}/bin:\${PATH}"
     runblock "-r" "2"
-      # workaround, runblock does not set # and $0 and so forth in its blocks (yet)
-      (writeExecline "nix-run-bin-rest-block" { readNArgs = 1; } [
-        "importas" "-ui" "storepath" "storepath"
-        "if" [ "echo" "\${storepath}/bin/\${1}" ]
-        "\${storepath}/bin/\${1}" "$@"
-      ])
   ];
 
   nix-eval = writeExecline "nix-eval" {} [