mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-07-20 23:51:03 +00:00
elixir: add maximumOTPVersion assertion
This commit is contained in:
@@ -5,4 +5,5 @@ mkDerivation {
|
||||
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";
|
||||
}
|
||||
|
||||
@@ -4,5 +4,6 @@ mkDerivation {
|
||||
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";
|
||||
}
|
||||
|
||||
@@ -4,5 +4,6 @@ mkDerivation {
|
||||
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";
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
version,
|
||||
erlang ? inputs.erlang,
|
||||
minimumOTPVersion,
|
||||
maximumOTPVersion ? null,
|
||||
sha256 ? null,
|
||||
rev ? "v${version}",
|
||||
src ? fetchFromGitHub {
|
||||
@@ -28,14 +29,37 @@
|
||||
|
||||
let
|
||||
inherit (lib)
|
||||
getVersion
|
||||
versionAtLeast
|
||||
optional
|
||||
assertMsg
|
||||
concatStringsSep
|
||||
getVersion
|
||||
optional
|
||||
optionalString
|
||||
toInt
|
||||
versions
|
||||
versionAtLeast
|
||||
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}";
|
||||
|
||||
Reference in New Issue
Block a user