summary refs log tree commit diff
path: root/pkgs/development/tools/ocaml
diff options
context:
space:
mode:
authorJules Aguillon <jules@j3s.fr>2023-09-27 11:59:21 +0200
committerVincent Laporte <vbgl@users.noreply.github.com>2023-09-27 14:49:44 +0200
commit91ab8ed21d681fc9f23f2a85df20e0f5c81efad3 (patch)
treed8a8173c0eabde535c9dfd24ccbefa640bd51150 /pkgs/development/tools/ocaml
parent52dce4809ca6fcf21ad4757466a341f4891dd603 (diff)
downloadnixpkgs-91ab8ed21d681fc9f23f2a85df20e0f5c81efad3.tar
nixpkgs-91ab8ed21d681fc9f23f2a85df20e0f5c81efad3.tar.gz
nixpkgs-91ab8ed21d681fc9f23f2a85df20e0f5c81efad3.tar.bz2
nixpkgs-91ab8ed21d681fc9f23f2a85df20e0f5c81efad3.tar.lz
nixpkgs-91ab8ed21d681fc9f23f2a85df20e0f5c81efad3.tar.xz
nixpkgs-91ab8ed21d681fc9f23f2a85df20e0f5c81efad3.tar.zst
nixpkgs-91ab8ed21d681fc9f23f2a85df20e0f5c81efad3.zip
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.nix9
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 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