From f42e2b00c9559b9335bf744b12a6de9534c3ca9a Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Sat, 7 Feb 2026 12:45:34 -0600 Subject: [PATCH] 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. --- nix/c-nif.nix | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/nix/c-nif.nix b/nix/c-nif.nix index a0c502ce..bf64d982 100644 --- a/nix/c-nif.nix +++ b/nix/c-nif.nix @@ -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