From 2d5053fca3de72a8cd5a7c71490bf5158e16094a Mon Sep 17 00:00:00 2001 From: Mathew Polzin Date: Sun, 3 Dec 2023 09:53:06 -0600 Subject: [PATCH] beamPackages.mixRelease: Make determinism toggleable --- pkgs/development/beam-modules/build-mix.nix | 6 +++++- pkgs/development/beam-modules/mix-release.nix | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/pkgs/development/beam-modules/build-mix.nix b/pkgs/development/beam-modules/build-mix.nix index a0e088a024ee..d61b5e91556b 100644 --- a/pkgs/development/beam-modules/build-mix.nix +++ b/pkgs/development/beam-modules/build-mix.nix @@ -6,6 +6,10 @@ , buildInputs ? [ ] , nativeBuildInputs ? [ ] , 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 , beamDeps ? [ ] , propagatedBuildInputs ? [ ] , postPatch ? "" @@ -35,7 +39,7 @@ let ERL_COMPILER_OPTIONS = let - options = [ "deterministic" ] ++ erlangCompilerOptions; + options = erlangCompilerOptions ++ lib.optionals erlangDeterministicBuilds [ "deterministic" ]; in "[${lib.concatStringsSep "," options}]"; diff --git a/pkgs/development/beam-modules/mix-release.nix b/pkgs/development/beam-modules/mix-release.nix index b25c609bd3bc..a762b8e0bc2e 100644 --- a/pkgs/development/beam-modules/mix-release.nix +++ b/pkgs/development/beam-modules/mix-release.nix @@ -33,6 +33,11 @@ # See https://www.erlang.org/doc/man/compile , 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 + # Mix dependencies provided as a fixed output derivation , mixFodDeps ? null @@ -100,7 +105,7 @@ stdenv.mkDerivation (overridable // { ERL_COMPILER_OPTIONS = let - options = [ "deterministic" ] ++ erlangCompilerOptions; + options = erlangCompilerOptions ++ lib.optionals erlangDeterministicBuilds [ "deterministic" ]; in "[${lib.concatStringsSep "," options}]";