about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatt Polzin <mpolzin@workwithopal.com>2023-11-30 15:16:40 -0600
committerYt <happysalada@tuta.io>2023-12-08 07:23:35 +0000
commit4600a9d60782a8832449fead0606f720e40169a1 (patch)
tree1296ec5f1e7fdca5aca8ef9b23f59b015a564a31
parent87e5690bba47126a6394d7c275f108932a11774b (diff)
beamPackages.mixRelease: deterministic erlang builds
-rw-r--r--pkgs/development/beam-modules/mix-release.nix10
1 files changed, 9 insertions, 1 deletions
diff --git a/pkgs/development/beam-modules/mix-release.nix b/pkgs/development/beam-modules/mix-release.nix
index e5b44bc5dcdb0..2248dce7a76b7 100644
--- a/pkgs/development/beam-modules/mix-release.nix
+++ b/pkgs/development/beam-modules/mix-release.nix
@@ -25,6 +25,12 @@
 , mixEnv ? "prod"
 , compileFlags ? [ ]
 
+  # Options to be passed to the Erlang compiler. As documented in the reference
+  # manual, these must be valid Erlang terms. They will be turned into an
+  # erlang list and set as the ERL_COMPILER_OPTIONS environment variable.
+  # See https://www.erlang.org/doc/man/compile
+, erlangCompilerOptions ? [ ]
+
   # Mix dependencies provided as a fixed output derivation
 , mixFodDeps ? null
 
@@ -63,7 +69,7 @@
 }@attrs:
 let
   # Remove non standard attributes that cannot be coerced to strings
-  overridable = builtins.removeAttrs attrs [ "compileFlags" "mixNixDeps" ];
+  overridable = builtins.removeAttrs attrs [ "compileFlags" "erlangCompilerOptions" "mixNixDeps" ];
 in
 assert mixNixDeps != { } -> mixFodDeps == null;
 assert stripDebug -> !enableDebugInfo;
@@ -89,6 +95,8 @@ stdenv.mkDerivation (overridable // {
   MIX_REBAR = "${rebar}/bin/rebar";
   MIX_REBAR3 = "${rebar3}/bin/rebar3";
 
+  ERL_COMPILER_OPTIONS = "[${lib.strings.concatStringsSep "," ([ "deterministic" ] ++ erlangCompilerOptions)}]";
+
   LC_ALL = "C.UTF-8";
 
   postUnpack = ''