Skip to content

Commit 8872103

Browse files
committed
fix: fix the nix module
`try` installed with the home manager module failed because it references /usr/bin/ruby which is absent on nixos. This fix removes the calls to ruby that broke nixos installations, as well as patching the shebang at the beginning
1 parent fa83e17 commit 8872103

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

flake.nix

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,16 @@
6969
version = "0.1.0";
7070

7171
src = inputs.self;
72-
nativeBuildInputs = [ pkgs.makeBinaryWrapper ];
72+
73+
postPatch = ''
74+
substituteInPlace try.rb \
75+
--replace-fail '#!/usr/bin/env ruby' '#!${ruby}/bin/ruby'
76+
'';
7377

7478
installPhase = ''
7579
mkdir -p $out/bin
7680
cp try.rb $out/bin/try
7781
chmod +x $out/bin/try
78-
79-
wrapProgram $out/bin/try \
80-
--prefix PATH : ${ruby}/bin
8182
'';
8283

8384
meta = with pkgs.lib; {

try.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,7 +1118,7 @@ def cmd_init!(args, tries_path)
11181118
bash_or_zsh_script = <<~SHELL
11191119
try() {
11201120
local out
1121-
out=$(/usr/bin/env ruby '#{script_path}' exec#{path_arg} "$@" 2>/dev/tty)
1121+
out=$('#{script_path}' exec#{path_arg} "$@" 2>/dev/tty)
11221122
if [ $? -eq 0 ]; then
11231123
eval "$out"
11241124
else
@@ -1129,7 +1129,7 @@ def cmd_init!(args, tries_path)
11291129

11301130
fish_script = <<~SHELL
11311131
function try
1132-
set -l out (/usr/bin/env ruby '#{script_path}' exec#{path_arg} $argv 2>/dev/tty | string collect)
1132+
set -l out ('#{script_path}' exec#{path_arg} $argv 2>/dev/tty | string collect)
11331133
if test $status -eq 0
11341134
eval $out
11351135
else

0 commit comments

Comments
 (0)