buildRebar3: enable deterministic builds (#434713)

authored by

Adam C. Stephens and committed by
GitHub
e4a689c0 96677427

+11 -3
+11 -3
pkgs/development/beam-modules/build-rebar3.nix
··· 21 21 buildPhase ? null, 22 22 configurePhase ? null, 23 23 meta ? { }, 24 - enableDebugInfo ? false, 24 + erlangCompilerOptions ? [ ], 25 + # Deterministic Erlang builds remove full system paths from debug information 26 + # among other things to keep builds more reproducible. See their docs for more: 27 + # https://www.erlang.org/doc/man/compile 28 + erlangDeterministicBuilds ? true, 25 29 ... 26 30 }@attrs: 27 31 28 32 let 29 - debugInfoFlag = lib.optionalString (enableDebugInfo || erlang.debugInfo) "debug-info"; 30 - 31 33 rebar3 = rebar3WithPlugins { 32 34 plugins = buildPlugins; 33 35 }; ··· 66 68 propagatedBuildInputs = lib.unique beamDeps; 67 69 68 70 inherit src; 71 + 72 + ERL_COMPILER_OPTIONS = 73 + let 74 + options = erlangCompilerOptions ++ lib.optionals erlangDeterministicBuilds [ "deterministic" ]; 75 + in 76 + "[${lib.concatStringsSep "," options}]"; 69 77 70 78 # stripping does not have any effect on beam files 71 79 # it is however needed for dependencies with NIFs