Unverified Commit e4a689c0 authored by Adam C. Stephens's avatar Adam C. Stephens Committed by GitHub
Browse files

buildRebar3: enable deterministic builds (#434713)

parents 96677427 bccaba9e
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -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