diff --git a/flake.nix b/flake.nix index 81bf2e1..78a7b1e 100644 --- a/flake.nix +++ b/flake.nix @@ -69,15 +69,16 @@ version = "0.1.0"; src = inputs.self; - nativeBuildInputs = [ pkgs.makeBinaryWrapper ]; + + postPatch = '' + substituteInPlace try.rb \ + --replace-fail '#!/usr/bin/env ruby' '#!${ruby}/bin/ruby' + ''; installPhase = '' mkdir -p $out/bin cp try.rb $out/bin/try chmod +x $out/bin/try - - wrapProgram $out/bin/try \ - --prefix PATH : ${ruby}/bin ''; meta = with pkgs.lib; { diff --git a/try.rb b/try.rb index 4aedf58..fcc9d94 100755 --- a/try.rb +++ b/try.rb @@ -1118,7 +1118,7 @@ def cmd_init!(args, tries_path) bash_or_zsh_script = <<~SHELL try() { local out - out=$(/usr/bin/env ruby '#{script_path}' exec#{path_arg} "$@" 2>/dev/tty) + out=$('#{script_path}' exec#{path_arg} "$@" 2>/dev/tty) if [ $? -eq 0 ]; then eval "$out" else @@ -1129,7 +1129,7 @@ def cmd_init!(args, tries_path) fish_script = <<~SHELL function try - set -l out (/usr/bin/env ruby '#{script_path}' exec#{path_arg} $argv 2>/dev/tty | string collect) + set -l out ('#{script_path}' exec#{path_arg} $argv 2>/dev/tty | string collect) if test $status -eq 0 eval $out else