beamPackages.mixRelease: deterministic erlang builds

This commit is contained in:
Matt Polzin 2023-11-30 15:16:40 -06:00 committed by Yt
parent 87e5690bba
commit 4600a9d607

View File

@ -25,6 +25,12 @@
, mixEnv ? "prod"
, compileFlags ? [ ]
# Options to be passed to the Erlang compiler. As documented in the reference
# manual, these must be valid Erlang terms. They will be turned into an
# erlang list and set as the ERL_COMPILER_OPTIONS environment variable.
# See https://www.erlang.org/doc/man/compile
, erlangCompilerOptions ? [ ]
# Mix dependencies provided as a fixed output derivation
, mixFodDeps ? null
@ -63,7 +69,7 @@
}@attrs:
let
# Remove non standard attributes that cannot be coerced to strings
overridable = builtins.removeAttrs attrs [ "compileFlags" "mixNixDeps" ];
overridable = builtins.removeAttrs attrs [ "compileFlags" "erlangCompilerOptions" "mixNixDeps" ];
in
assert mixNixDeps != { } -> mixFodDeps == null;
assert stripDebug -> !enableDebugInfo;
@ -89,6 +95,8 @@ stdenv.mkDerivation (overridable // {
MIX_REBAR = "${rebar}/bin/rebar";
MIX_REBAR3 = "${rebar3}/bin/rebar3";
ERL_COMPILER_OPTIONS = "[${lib.strings.concatStringsSep "," ([ "deterministic" ] ++ erlangCompilerOptions)}]";
LC_ALL = "C.UTF-8";
postUnpack = ''