aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/nixpkgs/pkgs/development/ocaml-modules/ocaml-lsp/default.nix
blob: 0db0164589cf2a08c7f43109e2bcdde48df955c2 (plain)
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
{ buildDunePackage
, stdlib-shims
, ppx_yojson_conv_lib
, ocaml-syntax-shims
, omd
, octavius
, dune-build-info
, uutf
, csexp
, cmdliner
, fetchzip
, lib
}:
let
  version = "1.1.0";
  src = fetchzip {
    url = "https://github.com/ocaml/ocaml-lsp/releases/download/${version}/ocaml-lsp-server-${version}.tbz";
    sha256 = "0al89waw43jl80k9z06kh44byhjhwb5hmzx07sddwi1kr1vc6jrb";
  };

  # 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 vendor/{octavius,uutf,ocaml-syntax-shims,omd,cmdliner}
  '';

  buildInputs = [
    stdlib-shims
    ppx_yojson_conv_lib
    ocaml-syntax-shims
    octavius
    uutf
    csexp
    dune-build-info
    omd
    cmdliner
  ];

  lsp = buildDunePackage {
    pname = "lsp";
    inherit version src;
    useDune2 = true;
    minimumOCamlVersion = "4.06";

    inherit buildInputs preBuild;
  };

in
buildDunePackage {
  pname = "ocaml-lsp-server";
  inherit version src;
  useDune2 = true;

  inherit preBuild;

  buildInputs = buildInputs ++ [ lsp ];

  meta = with lib; {
    description = "OCaml Language Server Protocol implementation";
    license = lib.licenses.isc;
    platforms = platforms.unix;
    maintainers = [ maintainers.symphorien ];
  };
}