diff options
-rw-r--r-- | pkgs/profpatsch/nix-tools.nix | 12 |
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" {} [ |