diff options
author | Jules Aguillon <jules@j3s.fr> | 2023-09-27 11:59:21 +0200 |
---|---|---|
committer | Vincent Laporte <vbgl@users.noreply.github.com> | 2023-09-27 14:49:44 +0200 |
commit | 91ab8ed21d681fc9f23f2a85df20e0f5c81efad3 (patch) | |
tree | d8a8173c0eabde535c9dfd24ccbefa640bd51150 /pkgs/development/tools/ocaml | |
parent | 52dce4809ca6fcf21ad4757466a341f4891dd603 (diff) |
ocamlPackages.merlin: Fix OCaml version shortening
The previous method was incompatible with future Merlin versions.
Diffstat (limited to 'pkgs/development/tools/ocaml')
-rw-r--r-- | pkgs/development/tools/ocaml/merlin/4.x.nix | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/pkgs/development/tools/ocaml/merlin/4.x.nix b/pkgs/development/tools/ocaml/merlin/4.x.nix index 6cd8154877eb5..06f358eb82816 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 |