beamPackages.elixir: avoid throwing for incompatibility in CI

These asserts should only trigger when a user tries to use that
combination. In CI, they should just not create an attrpath to evaluate.
This commit is contained in:
Wolfgang Walther 2025-07-19 10:21:31 +02:00
parent 9255558c37
commit 093e7390f1
No known key found for this signature in database
GPG Key ID: B39893FA5F65CAE1

View File

@ -1,4 +1,5 @@
{ {
config,
lib, lib,
stdenv, stdenv,
fetchFromGitHub, fetchFromGitHub,
@ -57,6 +58,8 @@ let
true true
else else
versionOlder (versions.major (getVersion erlang)) maxShiftMajor; versionOlder (versions.major (getVersion erlang)) maxShiftMajor;
minAssert = versionAtLeast (getVersion erlang) minimumOTPVersion;
bothAssert = minAssert && maxAssert;
elixirShebang = elixirShebang =
if stdenv.hostPlatform.isDarwin then if stdenv.hostPlatform.isDarwin then
@ -70,9 +73,11 @@ let
erlc_opts = [ "deterministic" ] ++ optionals debugInfo [ "debug_info" ]; erlc_opts = [ "deterministic" ] ++ optionals debugInfo [ "debug_info" ];
in in
assert assertMsg (versionAtLeast (getVersion erlang) minimumOTPVersion) compatibilityMsg; if !config.allowAliases && !bothAssert then
assert assertMsg maxAssert compatibilityMsg; # Don't throw without aliases to not break CI.
null
else
assert assertMsg bothAssert compatibilityMsg;
stdenv.mkDerivation { stdenv.mkDerivation {
pname = "${baseName}"; pname = "${baseName}";