Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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; {
Expand Down
4 changes: 2 additions & 2 deletions try.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down