# Pastebin 1fO3yby6 with import {}; with builtins; let erts_vsn = stdenv.mkDerivation { name = "erlang-version"; buildInputs = [erlang]; phases = "installPhase"; installPhase = '' mkdir -p $out erl -boot start_clean -eval \ 'Ver = erlang:system_info(version), io:format("~s~n", [Ver]), halt()' \ -noshell > $out/version ''; }; in stdenv.mkDerivation rec { name = "use"; phases = "installPhase"; installPhase = '' echo ERTS_VSN="$ERTS_VSN" mkdir $out echo "we don't care about this derivation, just shows how we'd set the env var." ''; ERTS_VSN = (replaceStrings ["\n"] [""] (readFile "${erts_vsn}/version")); }