diff --git a/pkgs/development/ocaml-modules/dune-action-plugin/default.nix b/pkgs/development/ocaml-modules/dune-action-plugin/default.nix index c39239525d1..1892c0dbada 100644 --- a/pkgs/development/ocaml-modules/dune-action-plugin/default.nix +++ b/pkgs/development/ocaml-modules/dune-action-plugin/default.nix @@ -10,6 +10,10 @@ buildDunePackage rec { propagatedBuildInputs = [ dune-glob dune-private-libs ]; + preBuild = '' + rm -r vendor/csexp + ''; + meta = with lib; { inherit (dune_3.meta) homepage; description = "API for writing dynamic Dune actions"; diff --git a/pkgs/development/ocaml-modules/dune-glob/default.nix b/pkgs/development/ocaml-modules/dune-glob/default.nix index 04b5e762379..59b78a7b775 100644 --- a/pkgs/development/ocaml-modules/dune-glob/default.nix +++ b/pkgs/development/ocaml-modules/dune-glob/default.nix @@ -10,6 +10,10 @@ buildDunePackage rec { propagatedBuildInputs = [ dune-private-libs ]; + preBuild = '' + rm -r vendor/csexp + ''; + meta = with lib; { inherit (dune_3.meta) homepage; description = "Glob string matching language supported by dune"; diff --git a/pkgs/development/ocaml-modules/dune-private-libs/default.nix b/pkgs/development/ocaml-modules/dune-private-libs/default.nix index 9b45064d198..ecd8a0016e6 100644 --- a/pkgs/development/ocaml-modules/dune-private-libs/default.nix +++ b/pkgs/development/ocaml-modules/dune-private-libs/default.nix @@ -13,6 +13,10 @@ buildDunePackage rec { propagatedBuildInputs = [ stdune ]; + preBuild = '' + rm -r vendor/csexp + ''; + meta = with lib; { description = "Private libraries of Dune"; maintainers = [ maintainers.marsam ]; diff --git a/pkgs/development/ocaml-modules/dune-rpc/default.nix b/pkgs/development/ocaml-modules/dune-rpc/default.nix new file mode 100644 index 00000000000..c0b2d958169 --- /dev/null +++ b/pkgs/development/ocaml-modules/dune-rpc/default.nix @@ -0,0 +1,23 @@ +{ lib, buildDunePackage, dune_3, stdune, ordering, pp, xdg, dyn }: + +buildDunePackage rec { + pname = "dune-rpc"; + inherit (dune_3) src version; + + duneVersion = "3"; + + dontAddPrefix = true; + + buildInputs = [ stdune ordering pp xdg dyn ]; + + preBuild = '' + rm -r vendor/csexp + ''; + + meta = with lib; { + description = "Library to connect and control a running dune instance"; + inherit (dune_3.meta) homepage; + maintainers = with lib.maintainers; [ ]; + license = licenses.mit; + }; +} diff --git a/pkgs/development/ocaml-modules/dune-site/default.nix b/pkgs/development/ocaml-modules/dune-site/default.nix index 8f51e182970..9eb2dcba5a4 100644 --- a/pkgs/development/ocaml-modules/dune-site/default.nix +++ b/pkgs/development/ocaml-modules/dune-site/default.nix @@ -10,6 +10,10 @@ buildDunePackage rec { propagatedBuildInputs = [ dune-private-libs ]; + preBuild = '' + rm -r vendor/csexp + ''; + meta = with lib; { description = "A library for embedding location information inside executable and libraries"; inherit (dune_3.meta) homepage; diff --git a/pkgs/development/ocaml-modules/fiber/default.nix b/pkgs/development/ocaml-modules/fiber/default.nix new file mode 100644 index 00000000000..fe805c82a35 --- /dev/null +++ b/pkgs/development/ocaml-modules/fiber/default.nix @@ -0,0 +1,23 @@ +{ lib, buildDunePackage, dune_3, stdune, dyn }: + +buildDunePackage rec { + pname = "fiber"; + inherit (dune_3) src version; + + duneVersion = "3"; + + dontAddPrefix = true; + + buildInputs = [ stdune dyn ]; + + preBuild = '' + rm -r vendor/csexp + ''; + + meta = with lib; { + description = "Structured concurrency library"; + inherit (dune_3.meta) homepage; + maintainers = with lib.maintainers; [ ]; + license = licenses.mit; + }; +} diff --git a/pkgs/development/ocaml-modules/ocaml-lsp/default.nix b/pkgs/development/ocaml-modules/ocaml-lsp/default.nix index 602f5eb77fe..c1831e660f4 100644 --- a/pkgs/development/ocaml-modules/ocaml-lsp/default.nix +++ b/pkgs/development/ocaml-modules/ocaml-lsp/default.nix @@ -1,14 +1,13 @@ -{ lib, buildDunePackage, jsonrpc, lsp, re, makeWrapper, dot-merlin-reader, spawn }: +{ lib, buildDunePackage, lsp, xdg, re, fiber, makeWrapper, dot-merlin-reader, spawn }: -buildDunePackage { +buildDunePackage rec { pname = "ocaml-lsp-server"; - inherit (jsonrpc) version src; - useDune2 = true; - - inherit (lsp) preBuild; + inherit (lsp) version src preBuild; + duneVersion = if lib.versionAtLeast version "1.10.0" then "3" else "2"; buildInputs = lsp.buildInputs ++ [ lsp re ] - ++ lib.optional (lib.versionAtLeast jsonrpc.version "1.9") spawn; + ++ lib.optional (lib.versionAtLeast version "1.9") spawn + ++ lib.optionals (lib.versionAtLeast version "1.10") [ fiber xdg ]; nativeBuildInputs = [ makeWrapper ]; @@ -16,7 +15,7 @@ buildDunePackage { wrapProgram $out/bin/ocamllsp --prefix PATH : ${dot-merlin-reader}/bin ''; - meta = jsonrpc.meta // { + meta = lsp.meta // { description = "OCaml Language Server Protocol implementation"; }; } diff --git a/pkgs/development/ocaml-modules/ocaml-lsp/jsonrpc.nix b/pkgs/development/ocaml-modules/ocaml-lsp/jsonrpc.nix index 4f192fe20ec..2e6802a5042 100644 --- a/pkgs/development/ocaml-modules/ocaml-lsp/jsonrpc.nix +++ b/pkgs/development/ocaml-modules/ocaml-lsp/jsonrpc.nix @@ -10,10 +10,14 @@ }: let params = - if lib.versionAtLeast ocaml.version "4.13" + if lib.versionAtLeast ocaml.version "4.14" then { - version = "1.10.3"; - sha256 = "sha256-o6wQc7Byi5T0vbARF3LAq69/9wMkOZRQ6rcVa/rBUfE="; + version = "1.11.3"; + sha256 = "sha256-KlMFh05O04I0Xil2B+nL2hUxZw0jaDMUnI23oUwGyhs="; + } else if lib.versionAtLeast ocaml.version "4.13" + then { + version = "1.10.5"; + sha256 = "sha256-TeJS6t1ruWhWPvWNatrnSUWI6T17XKiosHLYizBDDcw="; } else if lib.versionAtLeast ocaml.version "4.12" then { version = "1.9.0"; @@ -32,7 +36,7 @@ buildDunePackage rec { inherit (params) sha256; }; - useDune2 = true; + duneVersion = if lib.versionAtLeast version "1.10.0" then "3" else "2"; minimalOCamlVersion = "4.06"; buildInputs = diff --git a/pkgs/development/ocaml-modules/ocaml-lsp/lsp.nix b/pkgs/development/ocaml-modules/ocaml-lsp/lsp.nix index cd01116b820..faa14951907 100644 --- a/pkgs/development/ocaml-modules/ocaml-lsp/lsp.nix +++ b/pkgs/development/ocaml-modules/ocaml-lsp/lsp.nix @@ -8,18 +8,23 @@ , omd , octavius , dune-build-info +, dune-rpc , uutf +, dyn , re -, pp +, stdune +, dune_3 , csexp +, pp , cmdliner +, ordering , ocamlformat-rpc-lib }: buildDunePackage rec { pname = "lsp"; inherit (jsonrpc) version src; - useDune2 = true; + duneVersion = if lib.versionAtLeast version "1.10.0" then "3" else "2"; minimumOCamlVersion = if lib.versionAtLeast version "1.7.0" then "4.12" @@ -30,15 +35,30 @@ buildDunePackage rec { # 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 = '' + preBuild = lib.optionalString (lib.versionOlder version "1.10.4") '' rm -r ocaml-lsp-server/vendor/{octavius,uutf,omd,cmdliner} ''; buildInputs = - if lib.versionAtLeast version "1.7.0" then + if lib.versionAtLeast version "1.10.0" then + [ + pp + re + ppx_yojson_conv_lib + octavius + dune-build-info + dune-rpc + omd + cmdliner + ocamlformat-rpc-lib + dyn + stdune + ] + else if lib.versionAtLeast version "1.7.0" then [ pp re ppx_yojson_conv_lib octavius dune-build-info omd cmdliner ocamlformat-rpc-lib ] else - [ cppo + [ + cppo ppx_yojson_conv_lib ocaml-syntax-shims octavius diff --git a/pkgs/development/ocaml-modules/ocamlformat-rpc-lib/default.nix b/pkgs/development/ocaml-modules/ocamlformat-rpc-lib/default.nix index 9a1d26f21f0..e3582cbed1d 100644 --- a/pkgs/development/ocaml-modules/ocamlformat-rpc-lib/default.nix +++ b/pkgs/development/ocaml-modules/ocamlformat-rpc-lib/default.nix @@ -1,12 +1,24 @@ -{ lib, fetchurl, buildDunePackage, csexp, sexplib0 }: +{ lib, fetchurl, buildDunePackage, ocaml, csexp, sexplib0 }: + +# for compat with ocaml-lsp +let source = + if lib.versionAtLeast ocaml.version "4.13" + then { + version = "0.21.0"; + sha256 = "sha256-KhgX9rxYH/DM6fCqloe4l7AnJuKrdXSe6Y1XY3BXMy0="; + } else { + version = "0.20.0"; + sha256 = "sha256-JtmNCgwjbCyUE4bWqdH5Nc2YSit+rekwS43DcviIfgk="; + }; +in buildDunePackage rec { pname = "ocamlformat-rpc-lib"; - version = "0.19.0"; + inherit (source) version; src = fetchurl { url = "https://github.com/ocaml-ppx/ocamlformat/releases/download/${version}/ocamlformat-${version}.tbz"; - sha256 = "sha256-YvxGqujwpKM85/jXcm1xCb/2Fepvy1DRSC8h0g7lD0Y="; + inherit (source) sha256; }; minimumOCamlVersion = "4.08"; diff --git a/pkgs/development/ocaml-modules/stdune/default.nix b/pkgs/development/ocaml-modules/stdune/default.nix index fd1e4f987b4..5e0b798772d 100644 --- a/pkgs/development/ocaml-modules/stdune/default.nix +++ b/pkgs/development/ocaml-modules/stdune/default.nix @@ -1,4 +1,4 @@ -{ lib, buildDunePackage, dune_3, dyn, ordering }: +{ lib, buildDunePackage, dune_3, dyn, ordering, csexp }: buildDunePackage { pname = "stdune"; @@ -7,7 +7,11 @@ buildDunePackage { dontAddPrefix = true; - propagatedBuildInputs = [ dyn ordering ]; + propagatedBuildInputs = [ dyn ordering csexp ]; + + preBuild = '' + rm -r vendor/csexp + ''; meta = dune_3.meta // { description = "Dune's unstable standard library"; diff --git a/pkgs/development/ocaml-modules/xdg/default.nix b/pkgs/development/ocaml-modules/xdg/default.nix new file mode 100644 index 00000000000..8d3810fa7e9 --- /dev/null +++ b/pkgs/development/ocaml-modules/xdg/default.nix @@ -0,0 +1,17 @@ +{ lib, buildDunePackage, dune_3 }: + +buildDunePackage rec { + pname = "xdg"; + inherit (dune_3) src version; + + duneVersion = "3"; + + dontAddPrefix = true; + + meta = with lib; { + description = "XDG Base Directory Specification"; + inherit (dune_3.meta) homepage; + maintainers = with lib.maintainers; [ ]; + license = licenses.mit; + }; +} diff --git a/pkgs/top-level/ocaml-packages.nix b/pkgs/top-level/ocaml-packages.nix index 3619a844c72..9d7bce728c5 100644 --- a/pkgs/top-level/ocaml-packages.nix +++ b/pkgs/top-level/ocaml-packages.nix @@ -336,6 +336,8 @@ let inherit (pkgs) opam git mercurial coreutils gnutar bzip2; }; + dune-rpc = callPackage ../development/ocaml-modules/dune-rpc { }; + dune-site = callPackage ../development/ocaml-modules/dune-site { }; duration = callPackage ../development/ocaml-modules/duration { }; @@ -423,6 +425,8 @@ let inherit (pkgs) ffmpeg; }; + fiber = callPackage ../development/ocaml-modules/fiber { }; + fileutils = callPackage ../development/ocaml-modules/fileutils { }; findlib = callPackage ../development/tools/ocaml/findlib { }; @@ -1418,6 +1422,8 @@ let x509 = callPackage ../development/ocaml-modules/x509 { }; + xdg = callPackage ../development/ocaml-modules/xdg { }; + xenstore = callPackage ../development/ocaml-modules/xenstore { }; xenstore_transport = callPackage ../development/ocaml-modules/xenstore_transport { };