From 91ab8ed21d681fc9f23f2a85df20e0f5c81efad3 Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Wed, 27 Sep 2023 11:59:21 +0200 Subject: ocamlPackages.merlin: Fix OCaml version shortening The previous method was incompatible with future Merlin versions. --- pkgs/development/tools/ocaml/merlin/4.x.nix | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'pkgs/development/tools/ocaml') diff --git a/pkgs/development/tools/ocaml/merlin/4.x.nix b/pkgs/development/tools/ocaml/merlin/4.x.nix index 6cd8154877e..06f358eb828 100644 --- a/pkgs/development/tools/ocaml/merlin/4.x.nix +++ b/pkgs/development/tools/ocaml/merlin/4.x.nix @@ -28,8 +28,13 @@ let "4.10-500" = "sha256-m9+Qz8DT94yNSwpamTVLQKISHtRVBWnZD3t/yyujSZ0="; }; - ocamlVersionShorthand = lib.substring 0 3 - (lib.concatStrings (lib.splitVersion ocaml.version)); + 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}"; in -- cgit 1.4.1