ocamlPackages.merlin: Fix OCaml version shortening

The previous method was incompatible with future Merlin versions.
This commit is contained in:
Jules Aguillon
2023-09-27 14:49:44 +02:00
committed by Vincent Laporte
parent 52dce4809c
commit 91ab8ed21d
+7 -2
View File
@@ -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