elixir: use env shebang only on Darwin

This commit is contained in:
w
2025-01-09 05:45:17 +00:00
parent 8f15376424
commit 55442f689a

View File

@@ -57,6 +57,16 @@ let
true
else
versionOlder (versions.major (getVersion erlang)) maxShiftMajor;
elixirShebang =
if stdenv.hostPlatform.isDarwin then
# Darwin disallows shebang scripts from using other scripts as their
# command. Use env as an intermediary instead of calling elixir directly
# (another shebang script).
# See https://github.com/NixOS/nixpkgs/pull/9671
"${coreutils}/bin/env $out/bin/elixir"
else
"$out/bin/elixir";
in
assert assertMsg (versionAtLeast (getVersion erlang) minimumOTPVersion) compatibilityMsg;
assert assertMsg maxAssert compatibilityMsg;
@@ -104,7 +114,7 @@ stdenv.mkDerivation ({
done
substituteInPlace $out/bin/mix \
--replace "/usr/bin/env elixir" "${coreutils}/bin/env $out/bin/elixir"
--replace "/usr/bin/env elixir" "${elixirShebang}"
'';
pos = builtins.unsafeGetAttrPos "sha256" args;