elixir: add maximumOTPVersion assertion

Changed files
+30 -3
pkgs
development
+1
pkgs/development/interpreters/elixir/1.14.nix
···
sha256 = "sha256-bCCTjFT+FG1hz+0H6k/izbCmi0JgO3Kkqc3LWWCs5Po=";
# https://hexdocs.pm/elixir/1.14.5/compatibility-and-deprecations.html#compatibility-between-elixir-and-erlang-otp
minimumOTPVersion = "23";
+
maximumOTPVersion = "26";
}
+1
pkgs/development/interpreters/elixir/1.15.nix
···
sha256 = "sha256-6GfZycylh+sHIuiQk/GQr1pRQRY1uBycSQdsVJ0J13k=";
# https://hexdocs.pm/elixir/1.15.0/compatibility-and-deprecations.html#compatibility-between-elixir-and-erlang-otp
minimumOTPVersion = "24";
+
maximumOTPVersion = "26";
escriptPath = "lib/elixir/scripts/generate_app.escript";
}
+1
pkgs/development/interpreters/elixir/1.16.nix
···
sha256 = "sha256-WUBqoz3aQvBlSG3pTxGBpWySY7I0NUcDajQBgq5xYTU=";
# https://hexdocs.pm/elixir/1.16.0/compatibility-and-deprecations.html#compatibility-between-elixir-and-erlang-otp
minimumOTPVersion = "24";
+
maximumOTPVersion = "26";
escriptPath = "lib/elixir/scripts/generate_app.escript";
}
+27 -3
pkgs/development/interpreters/elixir/generic-builder.nix
···
version,
erlang ? inputs.erlang,
minimumOTPVersion,
+
maximumOTPVersion ? null,
sha256 ? null,
rev ? "v${version}",
src ? fetchFromGitHub {
···
let
inherit (lib)
+
assertMsg
+
concatStringsSep
getVersion
+
optional
+
optionalString
+
toInt
+
versions
versionAtLeast
-
optional
-
concatStringsSep
+
versionOlder
;
+
compatibilityMsg = ''
+
Unsupported elixir and erlang OTP combination.
+
+
elixir ${version}
+
erlang OTP ${getVersion erlang} is not >= ${minimumOTPVersion} ${
+
optionalString (maximumOTPVersion != null) "and <= ${maximumOTPVersion}"
+
}
+
+
See https://hexdocs.pm/elixir/${version}/compatibility-and-deprecations.html
+
'';
+
+
maxShiftMajor = builtins.toString ((toInt (versions.major maximumOTPVersion)) + 1);
+
maxAssert =
+
if (maximumOTPVersion == null) then
+
true
+
else
+
versionOlder (versions.major (getVersion erlang)) maxShiftMajor;
in
-
assert versionAtLeast (getVersion erlang) minimumOTPVersion;
+
assert assertMsg (versionAtLeast (getVersion erlang) minimumOTPVersion) compatibilityMsg;
+
assert assertMsg maxAssert compatibilityMsg;
stdenv.mkDerivation ({
pname = "${baseName}";