Skip to content

Commit dc5af8c

Browse files
authored
Add an ocaml-lsp-server flake compatible with ocaml.5.1.1 (#1)
Signed-off-by: Stephen Sherratt <[email protected]>
1 parent 4c27d81 commit dc5af8c

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

flakes/ocaml-lsp-server/flake.nix

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,28 @@
5252
yojson
5353
];
5454
};
55+
merlin-lib_4_16_501 = let version = "4.16-501";
56+
in ocamlPackages.buildDunePackage {
57+
pname = "merlin-lib";
58+
inherit version;
59+
src = pkgs.fetchurl {
60+
url =
61+
"https://github.com/ocaml/merlin/releases/download/v${version}/merlin-${version}.tbz";
62+
sha256 = "sha256-2lvzCbBAZFwpKuRXLMagpwDb0rz8mWrBPI5cODbCHiY=";
63+
};
64+
buildInputs = with ocamlPackages; [ csexp ];
65+
};
66+
merlinLibVersionByOcamlLspVersion =
67+
# Note that the version constraints in the ocaml-lsp-server package
68+
# are too broad and will try to use a version of merlin-lib too
69+
# recent to be compatible in some cases. This table maps versions
70+
# of ocaml-lsp-server to known compatible versions of merlin-lib.
71+
{
72+
"1.18.0" = merlin-lib_4_16_501;
73+
"1.19.0" = ocamlPackages.merlin-lib;
74+
};
75+
merlin-lib-for-this-ocaml-lsp =
76+
merlinLibVersionByOcamlLspVersion."${version}";
5577
in (ocamlPackages.buildDunePackage {
5678
pname = "ocaml-lsp-server";
5779
inherit src version;
@@ -65,7 +87,7 @@
6587
fiber
6688
jsonrpc
6789
lsp
68-
merlin-lib
90+
merlin-lib-for-this-ocaml-lsp
6991
ocamlc-loc
7092
ocamlformat-rpc-lib
7193
ppx_yojson_conv_lib
@@ -91,6 +113,12 @@
91113
isStatic = true;
92114
strip = true;
93115
};
116+
ocaml_lsp_server_1_18_0_ocaml_5_1_1_static = ocamllspPackage {
117+
version = "1.18.0";
118+
ocamlPackages = ocamlPackages_5_1;
119+
isStatic = true;
120+
strip = true;
121+
};
94122
};
95123
dynamicPackages = with pkgs.ocaml-ng; {
96124
ocaml_lsp_server_1_19_0_ocaml_5_2_0_dynamic = ocamllspPackage {
@@ -100,6 +128,13 @@
100128
strip =
101129
false; # stripping on macos produces executables that don't work
102130
};
131+
ocaml_lsp_server_1_18_0_ocaml_5_1_1_dynamic = ocamllspPackage {
132+
version = "1.18.0";
133+
ocamlPackages = ocamlPackages_5_1;
134+
isStatic = false;
135+
strip =
136+
false; # stripping on macos produces executables that don't work
137+
};
103138
};
104139
in { packages = staticPackages // dynamicPackages; });
105140
}

0 commit comments

Comments
 (0)