about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/ocaml-modules/ocaml-lsp/lsp.nix
blob: cd01116b8209640f0266c6b2b74202561d6bdd24 (plain) (blame)
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
{ buildDunePackage
, lib
, cppo
, stdlib-shims
, ppx_yojson_conv_lib
, ocaml-syntax-shims
, jsonrpc
, omd
, octavius
, dune-build-info
, uutf
, re
, pp
, csexp
, cmdliner
, ocamlformat-rpc-lib
}:

buildDunePackage rec {
  pname = "lsp";
  inherit (jsonrpc) version src;
  useDune2 = true;
  minimumOCamlVersion =
    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 = ''
    rm -r ocaml-lsp-server/vendor/{octavius,uutf,omd,cmdliner}
  '';

  buildInputs =
    if lib.versionAtLeast version "1.7.0" then
      [ pp re ppx_yojson_conv_lib octavius dune-build-info omd cmdliner ocamlformat-rpc-lib ]
    else
      [ cppo
        ppx_yojson_conv_lib
        ocaml-syntax-shims
        octavius
        dune-build-info
        omd
        cmdliner
      ];

  propagatedBuildInputs = [
    csexp
    jsonrpc
    uutf
  ] ++ lib.optional (lib.versionOlder version "1.7.0") stdlib-shims;

  meta = jsonrpc.meta // {
    description = "LSP protocol implementation in OCaml";
  };
}