fix: Dynamically find Erlang erts include directory

Find the erts include path dynamically instead of relying on
erlang.version which may not match the actual erts version.
This fixes 'erl_nif.h' file not found error.
This commit is contained in:
Graham McIntire 2026-02-07 12:45:34 -06:00
parent 1ad737e010
commit f42e2b00c9
No known key found for this signature in database

View file

@ -26,15 +26,13 @@ stdenv.mkDerivation {
erlang
];
# Set Erlang include path for NIF headers
preBuild = ''
export ERL_INCLUDE_PATH="${erlang}/lib/erlang/erts-${erlang.version}/include"
'';
# Build using the existing Makefile
buildPhase = ''
runHook preBuild
# Find the actual erts include directory
export ERL_INCLUDE_PATH=$(find ${erlang}/lib/erlang -type d -name "erts-*" | head -1)/include
cd c_src
make -j$NIX_BUILD_CORES