diff --git a/pkgs/development/ocaml-modules/cohttp/async.nix b/pkgs/development/ocaml-modules/cohttp/async.nix new file mode 100644 index 00000000000..246397b6081 --- /dev/null +++ b/pkgs/development/ocaml-modules/cohttp/async.nix @@ -0,0 +1,22 @@ +{ stdenv, buildDunePackage, async, cohttp, conduit-async, uri, ppx_sexp_conv +, logs, magic-mime }: + +if !stdenv.lib.versionAtLeast cohttp.version "0.99" then + cohttp +else if !stdenv.lib.versionAtLeast async.version "0.13" then + throw "cohttp-async needs async-0.13 (hence OCaml >= 4.08)" +else + + buildDunePackage { + pname = "cohttp-async"; + useDune2 = true; + inherit (cohttp) version src; + + buildInputs = [ ppx_sexp_conv ]; + + propagatedBuildInputs = [ async cohttp conduit-async logs magic-mime uri ]; + + meta = cohttp.meta // { + description = "CoHTTP implementation for the Async concurrency library"; + }; + } diff --git a/pkgs/development/ocaml-modules/conduit/async.nix b/pkgs/development/ocaml-modules/conduit/async.nix new file mode 100644 index 00000000000..f16819ed8ae --- /dev/null +++ b/pkgs/development/ocaml-modules/conduit/async.nix @@ -0,0 +1,19 @@ +{ stdenv, buildDunePackage, async, async_ssl, ppx_sexp_conv, conduit }: + +if !stdenv.lib.versionAtLeast conduit.version "1.0" +then conduit +else + +buildDunePackage { + pname = "conduit-async"; + useDune2 = true; + inherit (conduit) version src; + + buildInputs = [ ppx_sexp_conv ]; + + propagatedBuildInputs = [ async async_ssl conduit ]; + + meta = conduit.meta // { + description = "A network connection establishment library for Async"; + }; +} diff --git a/pkgs/development/ocaml-modules/conduit/default.nix b/pkgs/development/ocaml-modules/conduit/default.nix index 7fbeefb3926..27b2a329b26 100644 --- a/pkgs/development/ocaml-modules/conduit/default.nix +++ b/pkgs/development/ocaml-modules/conduit/default.nix @@ -18,7 +18,7 @@ buildDunePackage rec { propagatedBuildInputs = [ astring ipaddr ipaddr-sexp sexplib uri ]; meta = { - description = "Network connection library for TCP and SSL"; + description = "A network connection establishment library"; license = stdenv.lib.licenses.isc; maintainers = with stdenv.lib.maintainers; [ alexfmpe vbgl ]; homepage = "https://github.com/mirage/ocaml-conduit"; diff --git a/pkgs/development/ocaml-modules/janestreet/0.13.nix b/pkgs/development/ocaml-modules/janestreet/0.13.nix index d16ceefd04c..b92027a65a0 100644 --- a/pkgs/development/ocaml-modules/janestreet/0.13.nix +++ b/pkgs/development/ocaml-modules/janestreet/0.13.nix @@ -1,5 +1,6 @@ { janePackage , ctypes +, dune-configurator , num , octavius , ppxlib @@ -417,6 +418,15 @@ rec { propagatedBuildInputs = [ async shell ]; }; + async_ssl = janePackage { + pname = "async_ssl"; + useDune2 = true; + hash = "0z5dbiam5k7ipx9ph4r8nqv0a1ldx1ymxw3xjxgrdjda90lmwf2k"; + meta.description = "Async wrappers for SSL"; + buildInputs = [ dune-configurator ]; + propagatedBuildInputs = [ async ctypes openssl ]; + }; + core_bench = janePackage { pname = "core_bench"; hash = "1nk0i3z8rqrljbf4bc7ljp71g0a4361nh85s2ang0lgxri74zacm"; diff --git a/pkgs/top-level/ocaml-packages.nix b/pkgs/top-level/ocaml-packages.nix index a9bea0a60f6..ba02c3bb524 100644 --- a/pkgs/top-level/ocaml-packages.nix +++ b/pkgs/top-level/ocaml-packages.nix @@ -137,12 +137,16 @@ let cohttp = callPackage ../development/ocaml-modules/cohttp { }; + cohttp-async = callPackage ../development/ocaml-modules/cohttp/async.nix { }; + cohttp-lwt = callPackage ../development/ocaml-modules/cohttp/lwt.nix { }; cohttp-lwt-unix = callPackage ../development/ocaml-modules/cohttp/lwt-unix.nix { }; conduit = callPackage ../development/ocaml-modules/conduit { }; + conduit-async = callPackage ../development/ocaml-modules/conduit/async.nix { }; + conduit-lwt = callPackage ../development/ocaml-modules/conduit/lwt.nix { }; conduit-lwt-unix = callPackage ../development/ocaml-modules/conduit/lwt-unix.nix { }; @@ -991,7 +995,7 @@ let janeStreet = if lib.versionOlder "4.08" ocaml.version then import ../development/ocaml-modules/janestreet/0.13.nix { - inherit ctypes janePackage num octavius ppxlib re; + inherit ctypes dune-configurator janePackage num octavius ppxlib re; inherit (pkgs) openssl; } else if lib.versionOlder "4.07" ocaml.version