summary refs log tree commit diff
path: root/pkgs/development/ocaml-modules/cohttp
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2021-08-04 10:43:07 +0000
committerAlyssa Ross <hi@alyssa.is>2021-08-04 10:43:07 +0000
commit62614cbef7da005c1eda8c9400160f6bcd6546b8 (patch)
treec2630f69080637987b68acb1ee8676d2681fe304 /pkgs/development/ocaml-modules/cohttp
parentd9c82ed3044c72cecf01c6ea042489d30914577c (diff)
parente24069138dfec3ef94f211f1da005bb5395adc11 (diff)
downloadnixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar
nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar.gz
nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar.bz2
nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar.lz
nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar.xz
nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar.zst
nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.zip
Merge branch 'nixpkgs-update' into master
Diffstat (limited to 'pkgs/development/ocaml-modules/cohttp')
-rw-r--r--pkgs/development/ocaml-modules/cohttp/async.nix60
-rw-r--r--pkgs/development/ocaml-modules/cohttp/default.nix39
-rw-r--r--pkgs/development/ocaml-modules/cohttp/lwt-unix.nix33
-rw-r--r--pkgs/development/ocaml-modules/cohttp/lwt.nix27
-rw-r--r--pkgs/development/ocaml-modules/cohttp/mirage.nix23
5 files changed, 142 insertions, 40 deletions
diff --git a/pkgs/development/ocaml-modules/cohttp/async.nix b/pkgs/development/ocaml-modules/cohttp/async.nix
new file mode 100644
index 00000000000..060d2c6fb6a
--- /dev/null
+++ b/pkgs/development/ocaml-modules/cohttp/async.nix
@@ -0,0 +1,60 @@
+{ lib
+, buildDunePackage
+, ppx_sexp_conv
+, base
+, async
+, async_kernel
+, async_unix
+, cohttp
+, conduit-async
+, uri
+, uri-sexp
+, logs
+, fmt
+, sexplib0
+, ipaddr
+, magic-mime
+, ounit
+, mirage-crypto
+, core
+}:
+
+buildDunePackage {
+  pname = "cohttp-async";
+
+  inherit (cohttp)
+    version
+    src
+    minimumOCamlVersion
+    useDune2
+    ;
+
+  buildInputs = [ ppx_sexp_conv ];
+
+  propagatedBuildInputs = [
+    cohttp
+    conduit-async
+    async_kernel
+    async_unix
+    async
+    base
+    magic-mime
+    logs
+    fmt
+    sexplib0
+    uri
+    uri-sexp
+    ipaddr
+  ];
+
+  doCheck = true;
+  checkInputs = [
+    ounit
+    mirage-crypto
+    core
+  ];
+
+  meta = cohttp.meta // {
+    description = "CoHTTP implementation for the Async concurrency library";
+  };
+}
diff --git a/pkgs/development/ocaml-modules/cohttp/default.nix b/pkgs/development/ocaml-modules/cohttp/default.nix
index 6cb802e437d..c1dc973d0ee 100644
--- a/pkgs/development/ocaml-modules/cohttp/default.nix
+++ b/pkgs/development/ocaml-modules/cohttp/default.nix
@@ -1,27 +1,32 @@
 { lib, fetchurl, buildDunePackage
-, ppx_fields_conv, ppx_sexp_conv, stdlib-shims
-, base64, fieldslib, jsonm, re, stringext, uri-sexp
+, ppx_sexp_conv, base64, jsonm, re, stringext, uri-sexp
+, ocaml, fmt, alcotest
 }:
 
 buildDunePackage rec {
-	pname = "cohttp";
-	version = "2.5.4";
+  pname = "cohttp";
+  version = "4.0.0";
 
-	minimumOCamlVersion = "4.04.1";
+  useDune2 = true;
 
-	src = fetchurl {
-		url = "https://github.com/mirage/ocaml-cohttp/releases/download/v${version}/cohttp-v${version}.tbz";
-		sha256 = "1q04spmki5zis5p5m1vs77i3k7ijm134j62g61071vblwx25z17a";
-	};
+  minimumOCamlVersion = "4.08";
 
-	buildInputs = [ jsonm ppx_fields_conv ppx_sexp_conv ];
+  src = fetchurl {
+    url = "https://github.com/mirage/ocaml-cohttp/releases/download/v${version}/cohttp-v${version}.tbz";
+    sha256 = "bd7aa4cd2c82744990ed7c49e3ee7a40324c64cb3d8509804809155e2bacd1d2";
+  };
 
-	propagatedBuildInputs = [ base64 fieldslib re stringext uri-sexp stdlib-shims ];
+  buildInputs = [ jsonm ppx_sexp_conv ];
 
-	meta = {
-		description = "HTTP(S) library for Lwt, Async and Mirage";
-		license = lib.licenses.isc;
-		maintainers = [ lib.maintainers.vbgl ];
-		homepage = "https://github.com/mirage/ocaml-cohttp";
-	};
+  propagatedBuildInputs = [ base64 re stringext uri-sexp ];
+
+  doCheck = lib.versionAtLeast ocaml.version "4.05";
+  checkInputs = [ fmt alcotest ];
+
+  meta = {
+    description = "HTTP(S) library for Lwt, Async and Mirage";
+    license = lib.licenses.isc;
+    maintainers = [ lib.maintainers.vbgl ];
+    homepage = "https://github.com/mirage/ocaml-cohttp";
+  };
 }
diff --git a/pkgs/development/ocaml-modules/cohttp/lwt-unix.nix b/pkgs/development/ocaml-modules/cohttp/lwt-unix.nix
index 3a99ed9536f..57885b0e65e 100644
--- a/pkgs/development/ocaml-modules/cohttp/lwt-unix.nix
+++ b/pkgs/development/ocaml-modules/cohttp/lwt-unix.nix
@@ -1,19 +1,28 @@
-{ stdenv, buildDunePackage, cohttp-lwt
-, conduit-lwt-unix, ppx_sexp_conv
-, cmdliner, fmt, magic-mime
+{ lib, buildDunePackage, cohttp-lwt
+, conduit-lwt-unix, conduit-lwt, ppx_sexp_conv
+, cmdliner, fmt, logs, magic-mime
+, ounit
+, cacert
 }:
 
-if !stdenv.lib.versionAtLeast cohttp-lwt.version "0.99"
-then cohttp-lwt
-else
-
 buildDunePackage {
-	pname = "cohttp-lwt-unix";
-	inherit (cohttp-lwt) version src meta;
+  pname = "cohttp-lwt-unix";
+  inherit (cohttp-lwt) version src;
+
+  useDune2 = true;
+
+  buildInputs = [ cmdliner ppx_sexp_conv ];
 
-	useDune2 = true;
+  propagatedBuildInputs = [
+    cohttp-lwt conduit-lwt conduit-lwt-unix fmt logs magic-mime
+  ];
 
-	buildInputs = [ cmdliner ppx_sexp_conv ];
+  # TODO(@sternenseemann): fail for unknown reason
+  # https://github.com/mirage/ocaml-cohttp/issues/675#issuecomment-830692742
+  doCheck = false;
+  checkInputs = [ ounit cacert ];
 
-	propagatedBuildInputs = [ cohttp-lwt conduit-lwt-unix fmt magic-mime ];
+  meta = cohttp-lwt.meta // {
+    description = "CoHTTP implementation for Unix and Windows using Lwt";
+  };
 }
diff --git a/pkgs/development/ocaml-modules/cohttp/lwt.nix b/pkgs/development/ocaml-modules/cohttp/lwt.nix
index 1f261be6202..158aa3b27b2 100644
--- a/pkgs/development/ocaml-modules/cohttp/lwt.nix
+++ b/pkgs/development/ocaml-modules/cohttp/lwt.nix
@@ -1,16 +1,21 @@
-{ stdenv, buildDunePackage, cohttp, ocaml_lwt, uri, ppx_sexp_conv, logs }:
-
-if !stdenv.lib.versionAtLeast cohttp.version "0.99"
-then cohttp
-else if !stdenv.lib.versionAtLeast ppx_sexp_conv.version "0.13"
-then throw "cohttp-lwt is not available for ppx_sexp_conv version ${ppx_sexp_conv.version}"
-else
+{ lib, buildDunePackage, cohttp, ocaml_lwt, uri, ppx_sexp_conv, logs, sexplib0 }:
 
 buildDunePackage {
-	pname = "cohttp-lwt";
-	inherit (cohttp) version src meta;
+  pname = "cohttp-lwt";
+  inherit (cohttp)
+    version
+    src
+    useDune2
+    minimumOCamlVersion
+    ;
+
+  buildInputs = [ ppx_sexp_conv ];
 
-	buildInputs = [ uri ppx_sexp_conv ];
+  propagatedBuildInputs = [
+    cohttp ocaml_lwt logs sexplib0 uri
+  ];
 
-	propagatedBuildInputs = [ cohttp ocaml_lwt logs ];
+  meta = cohttp.meta // {
+    description = "CoHTTP implementation using the Lwt concurrency library";
+  };
 }
diff --git a/pkgs/development/ocaml-modules/cohttp/mirage.nix b/pkgs/development/ocaml-modules/cohttp/mirage.nix
new file mode 100644
index 00000000000..d2d3e945645
--- /dev/null
+++ b/pkgs/development/ocaml-modules/cohttp/mirage.nix
@@ -0,0 +1,23 @@
+{ buildDunePackage, cohttp, cohttp-lwt
+, mirage-flow, mirage-channel, mirage-kv
+, conduit, conduit-mirage, lwt
+, astring, magic-mime
+, ppx_sexp_conv
+}:
+
+buildDunePackage {
+  pname = "cohttp-mirage";
+
+  inherit (cohttp) version src minimumOCamlVersion useDune2;
+
+  nativeBuildInputs = [ ppx_sexp_conv ];
+
+  propagatedBuildInputs = [
+    mirage-flow mirage-channel conduit conduit-mirage mirage-kv
+    lwt cohttp cohttp-lwt astring magic-mime
+  ];
+
+  meta = cohttp.meta // {
+    description = "CoHTTP implementation for the MirageOS unikernel";
+  };
+}