From d08e1d78e74e20afd3abd993fb3de5738cbcf14f Mon Sep 17 00:00:00 2001 From: Symphorien Gibol Date: Sun, 21 Mar 2021 22:09:52 +0100 Subject: [PATCH] ocamlPackages.ocaml-lsp: wrap with dot-merlin-reader this requires that dot-merlin-reader be built with the same ocaml version as ocaml-lsp --- pkgs/development/ocaml-modules/ocaml-lsp/default.nix | 8 +++++++- pkgs/development/tools/ocaml/merlin/dot-merlin-reader.nix | 4 +--- pkgs/top-level/all-packages.nix | 2 +- pkgs/top-level/ocaml-packages.nix | 2 ++ 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/pkgs/development/ocaml-modules/ocaml-lsp/default.nix b/pkgs/development/ocaml-modules/ocaml-lsp/default.nix index 7ff18822e93..a56621465f3 100644 --- a/pkgs/development/ocaml-modules/ocaml-lsp/default.nix +++ b/pkgs/development/ocaml-modules/ocaml-lsp/default.nix @@ -1,4 +1,4 @@ -{ buildDunePackage, jsonrpc, lsp }: +{ buildDunePackage, jsonrpc, lsp, makeWrapper, dot-merlin-reader }: buildDunePackage { pname = "ocaml-lsp-server"; @@ -9,6 +9,12 @@ buildDunePackage { buildInputs = lsp.buildInputs ++ [ lsp ]; + nativeBuildInputs = [ makeWrapper ]; + + postInstall = '' + wrapProgram $out/bin/ocamllsp --prefix PATH : ${dot-merlin-reader}/bin + ''; + meta = jsonrpc.meta // { description = "OCaml Language Server Protocol implementation"; }; diff --git a/pkgs/development/tools/ocaml/merlin/dot-merlin-reader.nix b/pkgs/development/tools/ocaml/merlin/dot-merlin-reader.nix index 009998a3f85..b3b73776058 100644 --- a/pkgs/development/tools/ocaml/merlin/dot-merlin-reader.nix +++ b/pkgs/development/tools/ocaml/merlin/dot-merlin-reader.nix @@ -1,6 +1,4 @@ -{ lib, fetchurl, ocamlPackages }: - -with ocamlPackages; +{ lib, fetchurl, yojson, csexp, result, buildDunePackage }: buildDunePackage rec { pname = "dot-merlin-reader"; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index cd33fdf584f..804c9d335c5 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2240,7 +2240,7 @@ in dotenv-linter = callPackage ../development/tools/analysis/dotenv-linter { }; - dot-merlin-reader = callPackage ../development/tools/ocaml/merlin/dot-merlin-reader.nix { }; + inherit (ocamlPackages) dot-merlin-reader; dozenal = callPackage ../applications/misc/dozenal { }; diff --git a/pkgs/top-level/ocaml-packages.nix b/pkgs/top-level/ocaml-packages.nix index 0e3b21e59ad..6a8d29e42b2 100644 --- a/pkgs/top-level/ocaml-packages.nix +++ b/pkgs/top-level/ocaml-packages.nix @@ -624,6 +624,8 @@ let merlin-extend = callPackage ../development/ocaml-modules/merlin-extend { }; + dot-merlin-reader = callPackage ../development/tools/ocaml/merlin/dot-merlin-reader.nix { }; + metrics = callPackage ../development/ocaml-modules/metrics { }; metrics-influx = callPackage ../development/ocaml-modules/metrics/influx.nix { };