elixir: make mix interpreter path absolute

Remove the implicit dependency on `elixir` being somewhere in `PATH`.

Before:

```
$ nix build '.#elixir_1_15'
$ ./result/bin/mix --version
env: ‘elixir’: No such file or directory
```

After:

```
$ nix build '.#elixir_1_15'
$ ./result/bin/mix --version
Erlang/OTP 25 [erts-13.2.2.2] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit]

Mix 1.15.2 (compiled with Erlang/OTP 25)
```

This was caused by the shebang interpreter directive being set to
`${coreutils}/bin/env elixir`, whereas now the `elixir` part is replaced
with the full path to the interpreter.

We can't get rid of the `${coreutils}/bin/env` part, because without it
all scripts are interpreted as shell scripts.
This commit is contained in:
Daniel Kempkens 2023-07-17 23:45:54 +02:00 committed by Yt
parent e17114622d
commit c118bb4f9a

View file

@ -50,14 +50,14 @@ stdenv.mkDerivation ({
# to PATH so the scripts can run without problems.
for f in $out/bin/*; do
b=$(basename $f)
b=$(basename $f)
if [ "$b" = mix ]; then continue; fi
wrapProgram $f \
--prefix PATH ":" "${lib.makeBinPath [ erlang coreutils curl bash ]}"
done
substituteInPlace $out/bin/mix \
--replace "/usr/bin/env elixir" "${coreutils}/bin/env elixir"
--replace "/usr/bin/env elixir" "${coreutils}/bin/env $out/bin/elixir"
'';
pos = builtins.unsafeGetAttrPos "sha256" args;