elixir: add maximumOTPVersion assertion (#367986)

authored by Yt and committed by GitHub e86d0c5a 5cd56afa

+30 -3
+1
pkgs/development/interpreters/elixir/1.14.nix
··· 5 5 sha256 = "sha256-bCCTjFT+FG1hz+0H6k/izbCmi0JgO3Kkqc3LWWCs5Po="; 6 6 # https://hexdocs.pm/elixir/1.14.5/compatibility-and-deprecations.html#compatibility-between-elixir-and-erlang-otp 7 7 minimumOTPVersion = "23"; 8 + maximumOTPVersion = "26"; 8 9 }
+1
pkgs/development/interpreters/elixir/1.15.nix
··· 4 4 sha256 = "sha256-6GfZycylh+sHIuiQk/GQr1pRQRY1uBycSQdsVJ0J13k="; 5 5 # https://hexdocs.pm/elixir/1.15.0/compatibility-and-deprecations.html#compatibility-between-elixir-and-erlang-otp 6 6 minimumOTPVersion = "24"; 7 + maximumOTPVersion = "26"; 7 8 escriptPath = "lib/elixir/scripts/generate_app.escript"; 8 9 }
+1
pkgs/development/interpreters/elixir/1.16.nix
··· 4 4 sha256 = "sha256-WUBqoz3aQvBlSG3pTxGBpWySY7I0NUcDajQBgq5xYTU="; 5 5 # https://hexdocs.pm/elixir/1.16.0/compatibility-and-deprecations.html#compatibility-between-elixir-and-erlang-otp 6 6 minimumOTPVersion = "24"; 7 + maximumOTPVersion = "26"; 7 8 escriptPath = "lib/elixir/scripts/generate_app.escript"; 8 9 }
+27 -3
pkgs/development/interpreters/elixir/generic-builder.nix
··· 16 16 version, 17 17 erlang ? inputs.erlang, 18 18 minimumOTPVersion, 19 + maximumOTPVersion ? null, 19 20 sha256 ? null, 20 21 rev ? "v${version}", 21 22 src ? fetchFromGitHub { ··· 28 29 29 30 let 30 31 inherit (lib) 32 + assertMsg 33 + concatStringsSep 31 34 getVersion 35 + optional 36 + optionalString 37 + toInt 38 + versions 32 39 versionAtLeast 33 - optional 34 - concatStringsSep 40 + versionOlder 35 41 ; 36 42 43 + compatibilityMsg = '' 44 + Unsupported elixir and erlang OTP combination. 45 + 46 + elixir ${version} 47 + erlang OTP ${getVersion erlang} is not >= ${minimumOTPVersion} ${ 48 + optionalString (maximumOTPVersion != null) "and <= ${maximumOTPVersion}" 49 + } 50 + 51 + See https://hexdocs.pm/elixir/${version}/compatibility-and-deprecations.html 52 + ''; 53 + 54 + maxShiftMajor = builtins.toString ((toInt (versions.major maximumOTPVersion)) + 1); 55 + maxAssert = 56 + if (maximumOTPVersion == null) then 57 + true 58 + else 59 + versionOlder (versions.major (getVersion erlang)) maxShiftMajor; 37 60 in 38 - assert versionAtLeast (getVersion erlang) minimumOTPVersion; 61 + assert assertMsg (versionAtLeast (getVersion erlang) minimumOTPVersion) compatibilityMsg; 62 + assert assertMsg maxAssert compatibilityMsg; 39 63 40 64 stdenv.mkDerivation ({ 41 65 pname = "${baseName}";