From 0ee8802f859ff6d0e690618d0b172b209a845a47 Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Fri, 1 Dec 2023 17:51:10 +0100 Subject: [PATCH 1/2] =?UTF-8?q?ocamlPackages.merlin:=204.12=20=E2=86=92=20?= =?UTF-8?q?4.13?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The range of supported versions of OCaml for each versions of Merlin is no longer monotonic and can't be expressed with `lib.versionAtLeast` easily. The latest version of Merlin is now explicitly mapped for each version of OCaml. --- pkgs/development/tools/ocaml/merlin/4.x.nix | 29 ++++++++++++--------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/pkgs/development/tools/ocaml/merlin/4.x.nix b/pkgs/development/tools/ocaml/merlin/4.x.nix index ef9330054f35..a5dec7993d84 100644 --- a/pkgs/development/tools/ocaml/merlin/4.x.nix +++ b/pkgs/development/tools/ocaml/merlin/4.x.nix @@ -15,7 +15,18 @@ }: let - merlinVersion = if lib.versionAtLeast ocaml.version "4.14" then "4.12" else "4.7"; + # Each releases of Merlin support a limited range of versions of OCaml. + merlinVersions = { + "4.12.0" = "4.7-412"; + "4.12.1" = "4.7-412"; + "4.13.0" = "4.7-413"; + "4.13.1" = "4.7-413"; + "4.14.0" = "4.13-414"; + "4.14.1" = "4.13-414"; + "5.0.0" = "4.12-500"; + "5.1.0" = "4.13-501"; + # "5.1.1" = "4.13.1-501"; + }; hashes = { "4.7-412" = "sha256-0U3Ia7EblKULNy8AuXFVKACZvGN0arYJv7BWiBRgT0Y="; @@ -29,21 +40,15 @@ let "4.12-414" = "sha256-tgMUT4KyFeJubYVY1Sdv9ZvPB1JwcqEGcCuwuMqXHRQ="; "4.12-500" = "sha256-j49R7KVzNKlXDL7WibTHxPG4VSOVv0uaz5/yMZZjkH8="; "4.12-501" = "sha256-zMwzI1SXQDWQ9PaKL4o3J6JlRjmEs7lkXrwauy+QiMA="; + "4.13-414" = "sha256-AlzxqTuh5AkW9dnPIv51abv7r0A/VOS3JOT5IHix2wM="; + "4.13-501" = "sha256-G/VrI+qBVj2wxuB2qE9P1M73IvDmqmTrBFAA6mp+NRE="; }; - ocamlVersionShorthand = - let - v = lib.splitVersion ocaml.version; - major = builtins.elemAt v 0; - minor = builtins.elemAt v 1; - minor_prefix = if builtins.stringLength minor < 2 then "0" else ""; - in "${toString major}${minor_prefix}${toString minor}"; - - version = "${merlinVersion}-${ocamlVersionShorthand}"; + version = lib.getAttr ocaml.version merlinVersions; in -if !lib.hasAttr version hashes -then builtins.throw "merlin ${merlinVersion} is not available for OCaml ${ocaml.version}" +if !lib.hasAttr ocaml.version merlinVersions +then builtins.throw "merlin is not available for OCaml ${ocaml.version}" else buildDunePackage { From 7cb40bcdcc813097a36ad65781f8adfb68e9a5fe Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Fri, 1 Dec 2023 17:54:43 +0100 Subject: [PATCH 2/2] ocamlPackages.merlin: Drop unused source hashes The set of required source versions is now explicit, unused versions can be removed without fears. --- pkgs/development/tools/ocaml/merlin/4.x.nix | 8 -------- 1 file changed, 8 deletions(-) diff --git a/pkgs/development/tools/ocaml/merlin/4.x.nix b/pkgs/development/tools/ocaml/merlin/4.x.nix index a5dec7993d84..56871eab1cc1 100644 --- a/pkgs/development/tools/ocaml/merlin/4.x.nix +++ b/pkgs/development/tools/ocaml/merlin/4.x.nix @@ -31,15 +31,7 @@ let hashes = { "4.7-412" = "sha256-0U3Ia7EblKULNy8AuXFVKACZvGN0arYJv7BWiBRgT0Y="; "4.7-413" = "sha256-aVmGWS4bJBLuwsxDKsng/n0A6qlyJ/pnDTcYab/5gyU="; - "4.8-414" = "sha256-HMXWhcVOXW058y143rNBcfEOmjt2tZJXcXKHmKZ5i68="; - "4.8-500" = "sha256-n5NHKuo0/lZmfe7WskqnW3xm1S0PmXKSS93BDKrpjCI="; - "4.9-414" = "sha256-4j/EeBNZEmn/nSfIIJiOUgpmLIndCvfqZSshUXSZy/0="; - "4.9-500" = "sha256-uQfGazoxTxclHSiTfjji+tKJv8MKqRdHMPD/xfMZlSY="; - "4.10-414" = "sha256-/a1OqASISpb06eh2gsam1rE3wovM4CT8ybPV86XwR2c="; - "4.10-500" = "sha256-m9+Qz8DT94yNSwpamTVLQKISHtRVBWnZD3t/yyujSZ0="; - "4.12-414" = "sha256-tgMUT4KyFeJubYVY1Sdv9ZvPB1JwcqEGcCuwuMqXHRQ="; "4.12-500" = "sha256-j49R7KVzNKlXDL7WibTHxPG4VSOVv0uaz5/yMZZjkH8="; - "4.12-501" = "sha256-zMwzI1SXQDWQ9PaKL4o3J6JlRjmEs7lkXrwauy+QiMA="; "4.13-414" = "sha256-AlzxqTuh5AkW9dnPIv51abv7r0A/VOS3JOT5IHix2wM="; "4.13-501" = "sha256-G/VrI+qBVj2wxuB2qE9P1M73IvDmqmTrBFAA6mp+NRE="; };