diff --git a/pkgs/development/ocaml-modules/ocaml-lsp/default.nix b/pkgs/development/ocaml-modules/ocaml-lsp/default.nix new file mode 100644 index 000000000000..0db0164589cf --- /dev/null +++ b/pkgs/development/ocaml-modules/ocaml-lsp/default.nix @@ -0,0 +1,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 ]; + }; +} diff --git a/pkgs/top-level/ocaml-packages.nix b/pkgs/top-level/ocaml-packages.nix index 1cdcb31c97e8..757a77f0403a 100644 --- a/pkgs/top-level/ocaml-packages.nix +++ b/pkgs/top-level/ocaml-packages.nix @@ -654,6 +654,8 @@ let ocamlify = callPackage ../development/tools/ocaml/ocamlify { }; + ocaml-lsp = callPackage ../development/ocaml-modules/ocaml-lsp { }; + ocaml-migrate-parsetree = callPackage ../development/ocaml-modules/ocaml-migrate-parsetree { }; ocamlmod = callPackage ../development/tools/ocaml/ocamlmod { };