Commit bccaba9e authored by Asherah Connor's avatar Asherah Connor
Browse files

buildRebar3: add erlangDeterministicBuilds

The motivation is similar to (and implementation taken partly from)
#271288 --- some rebar3-compiled `.beam` files contain debug information
exposing references to `.hrl` files from the Erlang distribution it
was compiled with.  This results in unnecessary store references.

See also #423588's change to Elixir's `generic-builder.nix` where the
same option is used when building to avoid the same issue.
parent c81c8af1
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -21,6 +21,11 @@
  buildPhase ? null,
  configurePhase ? null,
  meta ? { },
  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:

@@ -64,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