diff --git a/pkgs/development/beam-modules/build-rebar3.nix b/pkgs/development/beam-modules/build-rebar3.nix index f8a3d668da48f..28e77449f05fa 100644 --- a/pkgs/development/beam-modules/build-rebar3.nix +++ b/pkgs/development/beam-modules/build-rebar3.nix @@ -21,13 +21,15 @@ buildPhase ? null, configurePhase ? null, meta ? { }, - enableDebugInfo ? false, + erlangCompilerOptions ? [ ], + # Deterministic Erlang builds remove full system paths from debug information + # among other things to keep builds more reproducible. See their docs for more: + # https://www.erlang.org/doc/man/compile + erlangDeterministicBuilds ? true, ... }@attrs: let - debugInfoFlag = lib.optionalString (enableDebugInfo || erlang.debugInfo) "debug-info"; - rebar3 = rebar3WithPlugins { plugins = buildPlugins; }; @@ -67,6 +69,12 @@ let inherit src; + ERL_COMPILER_OPTIONS = + let + options = erlangCompilerOptions ++ lib.optionals erlangDeterministicBuilds [ "deterministic" ]; + in + "[${lib.concatStringsSep "," options}]"; + # stripping does not have any effect on beam files # it is however needed for dependencies with NIFs # false is the default but we keep this for readability