1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
{ buildDunePackage
, lib
, cppo
, stdlib-shims
, ppx_yojson_conv_lib
, ocaml-syntax-shims
, jsonrpc
, omd
, octavius
, dune-build-info
, dune-rpc
, uutf
, dyn
, re
, stdune
, chrome-trace
, dune_3
, csexp
, result
, pp
, cmdliner
, ordering
, ocamlformat-rpc-lib
, ocaml
, version ?
if lib.versionAtLeast ocaml.version "4.14" then
"1.16.2"
else if lib.versionAtLeast ocaml.version "4.13" then
"1.10.5"
else if lib.versionAtLeast ocaml.version "4.12" then
"1.9.0"
else
"1.4.1"
}:
let jsonrpc_v = jsonrpc.override {
inherit version;
}; in
buildDunePackage rec {
pname = "lsp";
inherit (jsonrpc_v) version src;
duneVersion = "3";
minimalOCamlVersion =
if lib.versionAtLeast version "1.7.0" then
"4.12"
else
"4.06";
# unvendor some (not all) dependencies.
# They are vendored by upstream only because it is then easier to install
# ocaml-lsp without messing with your opam switch, but nix should prevent
# this type of problems without resorting to vendoring.
preBuild = lib.optionalString (lib.versionOlder version "1.10.4") ''
rm -r ocaml-lsp-server/vendor/{octavius,uutf,omd,cmdliner}
'';
buildInputs =
if lib.versionAtLeast version "1.12.0" then
[
pp
re
ppx_yojson_conv_lib
octavius
dune-build-info
dune-rpc
omd
cmdliner
ocamlformat-rpc-lib
dyn
stdune
chrome-trace
]
else if lib.versionAtLeast version "1.10.0" then
[
pp
re
ppx_yojson_conv_lib
octavius
dune-build-info
dune-rpc
omd
cmdliner
ocamlformat-rpc-lib
dyn
stdune
]
else if lib.versionAtLeast version "1.7.0" then
[ pp re ppx_yojson_conv_lib octavius dune-build-info omd cmdliner ocamlformat-rpc-lib ]
else
[
ppx_yojson_conv_lib
ocaml-syntax-shims
octavius
dune-build-info
omd
cmdliner
];
nativeBuildInputs = lib.optional (lib.versionOlder version "1.7.0") cppo;
propagatedBuildInputs =
if lib.versionAtLeast version "1.14.0" then [
jsonrpc
ppx_yojson_conv_lib
uutf
] else if lib.versionAtLeast version "1.10.0" then [
dyn
jsonrpc
ordering
ppx_yojson_conv_lib
stdune
uutf
] else if lib.versionAtLeast version "1.7.0" then [
csexp
jsonrpc
pp
ppx_yojson_conv_lib
result
uutf
] else [
csexp
jsonrpc
ppx_yojson_conv_lib
stdlib-shims
uutf
];
meta = jsonrpc.meta // {
description = "LSP protocol implementation in OCaml";
};
}
|