diff options
author | Antonio Nuno Monteiro <anmonteiro@gmail.com> | 2021-03-21 11:04:26 -0700 |
---|---|---|
committer | Antonio Nuno Monteiro <anmonteiro@gmail.com> | 2021-03-21 12:17:08 -0700 |
commit | 669cfc195fe46dc6b89ac7ad2c6f403c7457c0f9 (patch) | |
tree | 387a4c6efc8baae2414ae9365dc04eb34c82a4cb /pkgs/development/ocaml-modules/ocaml-lsp | |
parent | e6ca7b6e5b222cbbd0c91289a78c1f59a47f946d (diff) |
ocaml-lsp, lsp, jsonrpc: allow overriding the source globally
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
Diffstat (limited to 'pkgs/development/ocaml-modules/ocaml-lsp')
-rw-r--r-- | pkgs/development/ocaml-modules/ocaml-lsp/default.nix | 73 | ||||
-rw-r--r-- | pkgs/development/ocaml-modules/ocaml-lsp/jsonrpc.nix | 31 | ||||
-rw-r--r-- | pkgs/development/ocaml-modules/ocaml-lsp/lsp.nix | 44 |
3 files changed, 80 insertions, 68 deletions
diff --git a/pkgs/development/ocaml-modules/ocaml-lsp/default.nix b/pkgs/development/ocaml-modules/ocaml-lsp/default.nix index 46c84d8d70d21..7ff18822e9373 100644 --- a/pkgs/development/ocaml-modules/ocaml-lsp/default.nix +++ b/pkgs/development/ocaml-modules/ocaml-lsp/default.nix @@ -1,78 +1,15 @@ -{ 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.1"; - src = fetchzip { - url = "https://github.com/ocaml/ocaml-lsp/releases/download/${version}/jsonrpc-${version}.tbz"; - sha256 = "0hzpw17qfhb0cxgwah1fv4k300r363dy1kv0977anl44dlanx1v5"; - }; - - # 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; - }; - - jsonrpc = buildDunePackage { - pname = "jsonrpc"; - inherit version src; - useDune2 = true; - minimumOCamlVersion = "4.06"; - - buildInputs = [ yojson stdlib-shims ocaml-syntax-shims ppx_yojson_conv_lib result ]; - }; +{ buildDunePackage, jsonrpc, lsp }: -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 ]; - meta = with lib; { + meta = jsonrpc.meta // { description = "OCaml Language Server Protocol implementation"; - license = lib.licenses.isc; - platforms = platforms.unix; - maintainers = [ maintainers.symphorien maintainers.marsam ]; }; } diff --git a/pkgs/development/ocaml-modules/ocaml-lsp/jsonrpc.nix b/pkgs/development/ocaml-modules/ocaml-lsp/jsonrpc.nix new file mode 100644 index 0000000000000..701604c8710ad --- /dev/null +++ b/pkgs/development/ocaml-modules/ocaml-lsp/jsonrpc.nix @@ -0,0 +1,31 @@ +{ buildDunePackage +, stdlib-shims +, ppx_yojson_conv_lib +, ocaml-syntax-shims +, yojson +, result +, fetchzip +, lib +}: + + +buildDunePackage rec { + pname = "jsonrpc"; + version = "1.4.1"; + src = fetchzip { + url = "https://github.com/ocaml/ocaml-lsp/releases/download/${version}/jsonrpc-${version}.tbz"; + sha256 = "0hzpw17qfhb0cxgwah1fv4k300r363dy1kv0977anl44dlanx1v5"; + }; + + useDune2 = true; + minimumOCamlVersion = "4.06"; + + buildInputs = [ yojson stdlib-shims ocaml-syntax-shims ppx_yojson_conv_lib result ]; + + meta = with lib; { + description = "Jsonrpc protocol implementation in OCaml"; + license = licenses.isc; + platforms = platforms.unix; + maintainers = with maintainers; [ symphorien marsam ]; + }; +} diff --git a/pkgs/development/ocaml-modules/ocaml-lsp/lsp.nix b/pkgs/development/ocaml-modules/ocaml-lsp/lsp.nix new file mode 100644 index 0000000000000..b501282c1558c --- /dev/null +++ b/pkgs/development/ocaml-modules/ocaml-lsp/lsp.nix @@ -0,0 +1,44 @@ +{ buildDunePackage +, stdlib-shims +, ppx_yojson_conv_lib +, ocaml-syntax-shims +, jsonrpc +, omd +, octavius +, dune-build-info +, uutf +, csexp +, cmdliner +}: + +buildDunePackage { + pname = "lsp"; + inherit (jsonrpc) version src; + useDune2 = true; + minimumOCamlVersion = "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,ocaml-syntax-shims,omd,cmdliner} + ''; + + buildInputs = [ + stdlib-shims + ppx_yojson_conv_lib + ocaml-syntax-shims + octavius + uutf + csexp + dune-build-info + omd + cmdliner + jsonrpc + ]; + + meta = jsonrpc.meta // { + description = "LSP protocol implementation in OCaml"; + }; +} |