From c118bb4f9ad9497c951a9aa3fbe142df837fc329 Mon Sep 17 00:00:00 2001 From: Daniel Kempkens Date: Mon, 17 Jul 2023 23:45:54 +0200 Subject: [PATCH] elixir: make mix interpreter path absolute MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- pkgs/development/interpreters/elixir/generic-builder.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/interpreters/elixir/generic-builder.nix b/pkgs/development/interpreters/elixir/generic-builder.nix index af6982156103..9007ab12d754 100644 --- a/pkgs/development/interpreters/elixir/generic-builder.nix +++ b/pkgs/development/interpreters/elixir/generic-builder.nix @@ -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;