Merge pull request #117133 from anmonteiro/anmonteiro/ocaml-lsp-overridable

ocaml-lsp, lsp, jsonrpc: allow overriding the source globally

authored by Guillaume Girol and committed by GitHub 7a6d0468 933fa2aa

+82 -68
+5 -68
pkgs/development/ocaml-modules/ocaml-lsp/default.nix
··· 1 - { buildDunePackage 2 - , stdlib-shims 3 - , ppx_yojson_conv_lib 4 - , ocaml-syntax-shims 5 - , yojson 6 - , result 7 - , omd 8 - , octavius 9 - , dune-build-info 10 - , uutf 11 - , csexp 12 - , cmdliner 13 - , fetchzip 14 - , lib 15 - }: 16 - let 17 - version = "1.4.1"; 18 - src = fetchzip { 19 - url = "https://github.com/ocaml/ocaml-lsp/releases/download/${version}/jsonrpc-${version}.tbz"; 20 - sha256 = "0hzpw17qfhb0cxgwah1fv4k300r363dy1kv0977anl44dlanx1v5"; 21 - }; 1 + { buildDunePackage, jsonrpc, lsp }: 22 2 23 - # unvendor some (not all) dependencies. 24 - # They are vendored by upstream only because it is then easier to install 25 - # ocaml-lsp without messing with your opam switch, but nix should prevent 26 - # this type of problems without resorting to vendoring. 27 - preBuild = '' 28 - rm -r ocaml-lsp-server/vendor/{octavius,uutf,ocaml-syntax-shims,omd,cmdliner} 29 - ''; 30 - 31 - buildInputs = [ 32 - stdlib-shims 33 - ppx_yojson_conv_lib 34 - ocaml-syntax-shims 35 - octavius 36 - uutf 37 - csexp 38 - dune-build-info 39 - omd 40 - cmdliner 41 - jsonrpc 42 - ]; 43 - 44 - lsp = buildDunePackage { 45 - pname = "lsp"; 46 - inherit version src; 47 - useDune2 = true; 48 - minimumOCamlVersion = "4.06"; 49 - 50 - inherit buildInputs preBuild; 51 - }; 52 - 53 - jsonrpc = buildDunePackage { 54 - pname = "jsonrpc"; 55 - inherit version src; 56 - useDune2 = true; 57 - minimumOCamlVersion = "4.06"; 58 - 59 - buildInputs = [ yojson stdlib-shims ocaml-syntax-shims ppx_yojson_conv_lib result ]; 60 - }; 61 - 62 - in 63 3 buildDunePackage { 64 4 pname = "ocaml-lsp-server"; 65 - inherit version src; 5 + inherit (jsonrpc) version src; 66 6 useDune2 = true; 67 7 68 - inherit preBuild; 8 + inherit (lsp) preBuild; 69 9 70 - buildInputs = buildInputs ++ [ lsp ]; 10 + buildInputs = lsp.buildInputs ++ [ lsp ]; 71 11 72 - meta = with lib; { 12 + meta = jsonrpc.meta // { 73 13 description = "OCaml Language Server Protocol implementation"; 74 - license = lib.licenses.isc; 75 - platforms = platforms.unix; 76 - maintainers = [ maintainers.symphorien maintainers.marsam ]; 77 14 }; 78 15 }
+31
pkgs/development/ocaml-modules/ocaml-lsp/jsonrpc.nix
··· 1 + { buildDunePackage 2 + , stdlib-shims 3 + , ppx_yojson_conv_lib 4 + , ocaml-syntax-shims 5 + , yojson 6 + , result 7 + , fetchzip 8 + , lib 9 + }: 10 + 11 + 12 + buildDunePackage rec { 13 + pname = "jsonrpc"; 14 + version = "1.4.1"; 15 + src = fetchzip { 16 + url = "https://github.com/ocaml/ocaml-lsp/releases/download/${version}/jsonrpc-${version}.tbz"; 17 + sha256 = "0hzpw17qfhb0cxgwah1fv4k300r363dy1kv0977anl44dlanx1v5"; 18 + }; 19 + 20 + useDune2 = true; 21 + minimumOCamlVersion = "4.06"; 22 + 23 + buildInputs = [ yojson stdlib-shims ocaml-syntax-shims ppx_yojson_conv_lib result ]; 24 + 25 + meta = with lib; { 26 + description = "Jsonrpc protocol implementation in OCaml"; 27 + license = licenses.isc; 28 + platforms = platforms.unix; 29 + maintainers = with maintainers; [ symphorien marsam ]; 30 + }; 31 + }
+44
pkgs/development/ocaml-modules/ocaml-lsp/lsp.nix
··· 1 + { buildDunePackage 2 + , stdlib-shims 3 + , ppx_yojson_conv_lib 4 + , ocaml-syntax-shims 5 + , jsonrpc 6 + , omd 7 + , octavius 8 + , dune-build-info 9 + , uutf 10 + , csexp 11 + , cmdliner 12 + }: 13 + 14 + buildDunePackage { 15 + pname = "lsp"; 16 + inherit (jsonrpc) version src; 17 + useDune2 = true; 18 + minimumOCamlVersion = "4.06"; 19 + 20 + # unvendor some (not all) dependencies. 21 + # They are vendored by upstream only because it is then easier to install 22 + # ocaml-lsp without messing with your opam switch, but nix should prevent 23 + # this type of problems without resorting to vendoring. 24 + preBuild = '' 25 + rm -r ocaml-lsp-server/vendor/{octavius,uutf,ocaml-syntax-shims,omd,cmdliner} 26 + ''; 27 + 28 + buildInputs = [ 29 + stdlib-shims 30 + ppx_yojson_conv_lib 31 + ocaml-syntax-shims 32 + octavius 33 + uutf 34 + csexp 35 + dune-build-info 36 + omd 37 + cmdliner 38 + jsonrpc 39 + ]; 40 + 41 + meta = jsonrpc.meta // { 42 + description = "LSP protocol implementation in OCaml"; 43 + }; 44 + }
+2
pkgs/top-level/ocaml-packages.nix
··· 781 781 782 782 ocamlify = callPackage ../development/tools/ocaml/ocamlify { }; 783 783 784 + jsonrpc = callPackage ../development/ocaml-modules/ocaml-lsp/jsonrpc.nix { }; 785 + lsp = callPackage ../development/ocaml-modules/ocaml-lsp/lsp.nix { }; 784 786 ocaml-lsp = callPackage ../development/ocaml-modules/ocaml-lsp { }; 785 787 786 788 ocaml-migrate-parsetree = ocaml-migrate-parsetree-1-8;