about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/ocaml-modules/ocaml-lsp/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/ocaml-modules/ocaml-lsp/default.nix')
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/ocaml-lsp/default.nix79
1 files changed, 11 insertions, 68 deletions
diff --git a/nixpkgs/pkgs/development/ocaml-modules/ocaml-lsp/default.nix b/nixpkgs/pkgs/development/ocaml-modules/ocaml-lsp/default.nix
index 0391498c37ae..a56621465f34 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/ocaml-lsp/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/ocaml-lsp/default.nix
@@ -1,78 +1,21 @@
-{ buildDunePackage
-, stdlib-shims
-, ppx_yojson_conv_lib
-, ocaml-syntax-shims
-, yojson
-, result
-, omd
-, octavius
-, dune-build-info
-, uutf
-, csexp
-, cmdliner
-, fetchzip
-, lib
-}:
-let
-  version = "1.4.0";
-  src = fetchzip {
-    url = "https://github.com/ocaml/ocaml-lsp/releases/download/${version}/jsonrpc-${version}.tbz";
-    sha256 = "16vvwq3d9xmr91r6yv5i2gyqcdliji7asyq4g6iygi617233fa33";
-  };
-
-  # 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,ocaml-syntax-shims,omd,cmdliner}
-  '';
-
-  buildInputs = [
-    stdlib-shims
-    ppx_yojson_conv_lib
-    ocaml-syntax-shims
-    octavius
-    uutf
-    csexp
-    dune-build-info
-    omd
-    cmdliner
-    jsonrpc
-  ];
-
-  lsp = buildDunePackage {
-    pname = "lsp";
-    inherit version src;
-    useDune2 = true;
-    minimumOCamlVersion = "4.06";
-
-    inherit buildInputs preBuild;
-  };
+{ buildDunePackage, jsonrpc, lsp, makeWrapper, dot-merlin-reader }:
 
-  jsonrpc = buildDunePackage {
-    pname = "jsonrpc";
-    inherit version src;
-    useDune2 = true;
-    minimumOCamlVersion = "4.06";
-
-    buildInputs = [ yojson stdlib-shims ocaml-syntax-shims ppx_yojson_conv_lib result ];
-  };
-
-in
 buildDunePackage {
   pname = "ocaml-lsp-server";
-  inherit version src;
+  inherit (jsonrpc) version src;
   useDune2 = true;
 
-  inherit preBuild;
+  inherit (lsp) preBuild;
 
-  buildInputs = buildInputs ++ [ lsp ];
+  buildInputs = lsp.buildInputs ++ [ lsp ];
+
+  nativeBuildInputs = [ makeWrapper ];
+
+  postInstall = ''
+    wrapProgram $out/bin/ocamllsp --prefix PATH : ${dot-merlin-reader}/bin
+  '';
 
-  meta = with lib; {
+  meta = jsonrpc.meta // {
     description = "OCaml Language Server Protocol implementation";
-    license = lib.licenses.isc;
-    platforms = platforms.unix;
-    maintainers = [ maintainers.symphorien ];
   };
 }