diff --git a/pkgs/development/interpreters/elixir/generic-builder.nix b/pkgs/development/interpreters/elixir/generic-builder.nix index b3a7f60e03080..1abbdd25c9892 100644 --- a/pkgs/development/interpreters/elixir/generic-builder.nix +++ b/pkgs/development/interpreters/elixir/generic-builder.nix @@ -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;