lol
1{ buildDunePackage
2, stdlib-shims
3, ppx_yojson_conv_lib
4, ocaml-syntax-shims
5, yojson
6, result
7, fetchurl
8, lib
9, ocaml
10, version ?
11 if lib.versionAtLeast ocaml.version "4.14" then
12 "1.16.2"
13 else if lib.versionAtLeast ocaml.version "4.13" then
14 "1.10.5"
15 else if lib.versionAtLeast ocaml.version "4.12" then
16 "1.9.0"
17 else
18 "1.4.1"
19}:
20
21let params = {
22 "1.16.2" = {
23 name = "lsp";
24 minimalOCamlVersion = "4.14";
25 sha256 = "sha256-FIfVpOLy1PAjNBBYVRvbi6hsIzZ7fFtP3aOqfcAqrsQ=";
26 };
27 "1.14.2" = {
28 name = "lsp";
29 minimalOCamlVersion = "4.14";
30 sha256 = "sha256-1R+HYaGbPLGDs5DMN3jmnrZFMhMmPUHgF+s+yNzIVJQ=";
31 };
32 "1.10.5" = {
33 name = "jsonrpc";
34 minimalOCamlVersion = "4.13";
35 sha256 = "sha256-TeJS6t1ruWhWPvWNatrnSUWI6T17XKiosHLYizBDDcw=";
36 };
37 "1.9.0" = {
38 name = "jsonrpc";
39 minimalOCamlVersion = "4.12";
40 sha256 = "sha256:1ac44n6g3rf84gvhcca545avgf9vpkwkkkm0s8ipshfhp4g4jikh";
41 };
42 "1.4.1" = {
43 name = "jsonrpc";
44 minimalOCamlVersion = "4.06";
45 sha256 = "1ssyazc0yrdng98cypwa9m3nzfisdzpp7hqnx684rqj8f0g3gs6f";
46 };
47}."${version}"; in
48
49buildDunePackage rec {
50 pname = "jsonrpc";
51 inherit version;
52 src = fetchurl {
53 url = "https://github.com/ocaml/ocaml-lsp/releases/download/${version}/${params.name}-${version}.tbz";
54 inherit (params) sha256;
55 };
56
57 duneVersion = "3";
58 inherit (params) minimalOCamlVersion;
59
60 buildInputs =
61 if lib.versionAtLeast version "1.7.0" then
62 [ ]
63 else
64 [ yojson stdlib-shims ocaml-syntax-shims ];
65
66 propagatedBuildInputs =
67 if lib.versionAtLeast version "1.7.0" then
68 [ ]
69 else
70 [ ppx_yojson_conv_lib result ];
71
72 meta = with lib; {
73 description = "Jsonrpc protocol implementation in OCaml";
74 license = licenses.isc;
75 platforms = platforms.unix;
76 maintainers = with maintainers; [ marsam ];
77 };
78}