summary refs log tree commit diff
path: root/pkgs/development/ocaml-modules
diff options
context:
space:
mode:
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>2021-04-26 12:06:35 +0000
committerGitHub <noreply@github.com>2021-04-26 12:06:35 +0000
commite30742adc3e699ec40ccc73d2d44fef5a1c0fbaa (patch)
treeebf7f67b4ec546b7cc56ae18666827e0c4ba53f7 /pkgs/development/ocaml-modules
parent48c952c039b224ea4bde5afa6c9a9b88fa46e550 (diff)
parent7eb8318faa380602c6cc44c9b516e59fba981e49 (diff)
Merge staging-next into staging
Diffstat (limited to 'pkgs/development/ocaml-modules')
-rw-r--r--pkgs/development/ocaml-modules/h2/default.nix59
-rw-r--r--pkgs/development/ocaml-modules/hpack/default.nix37
2 files changed, 96 insertions, 0 deletions
diff --git a/pkgs/development/ocaml-modules/h2/default.nix b/pkgs/development/ocaml-modules/h2/default.nix
new file mode 100644
index 0000000000000..dd96e0ecc441f
--- /dev/null
+++ b/pkgs/development/ocaml-modules/h2/default.nix
@@ -0,0 +1,59 @@
+{ buildDunePackage
+, lib
+, fetchFromGitHub
+, ocaml
+, hpack
+, angstrom
+, faraday
+, base64
+, psq
+, httpaf
+, alcotest
+, yojson
+, hex
+}:
+
+let
+  http2-frame-test-case = fetchFromGitHub {
+    owner = "http2jp";
+    repo = "http2-frame-test-case";
+    rev = "5c67db0d4d68e1fb7d3a241d6e01fc04d981f465";
+    sha256 = "16yyb37f8mk9saw7ndjs5is67yq7qa6b6y7k0c75ibxi4n9aw1r3";
+  };
+in
+
+buildDunePackage rec {
+  pname = "h2";
+
+  inherit (hpack)
+    version
+    src
+    useDune2
+    ;
+
+  minimumOCamlVersion = "4.06";
+
+  propagatedBuildInputs = [
+    angstrom
+    faraday
+    base64
+    psq
+    hpack
+    httpaf
+  ];
+
+  # Tests fail with 4.06
+  doCheck = lib.versionAtLeast ocaml.version "4.07";
+  preCheck = ''
+    ln -s "${http2-frame-test-case}" lib_test/http2-frame-test-case
+  '';
+  checkInputs = [
+    alcotest
+    yojson
+    hex
+  ];
+
+  meta = hpack.meta // {
+    description = "A high-performance, memory-efficient, and scalable HTTP/2 library for OCaml";
+  };
+}
diff --git a/pkgs/development/ocaml-modules/hpack/default.nix b/pkgs/development/ocaml-modules/hpack/default.nix
new file mode 100644
index 0000000000000..ec967312b8743
--- /dev/null
+++ b/pkgs/development/ocaml-modules/hpack/default.nix
@@ -0,0 +1,37 @@
+{ buildDunePackage
+, lib
+, fetchurl
+, angstrom
+, faraday
+}:
+
+buildDunePackage rec {
+  pname = "hpack";
+  version = "0.8.0";
+
+  src = fetchurl {
+    url = "https://github.com/anmonteiro/ocaml-h2/releases/download/${version}/h2-${version}.tbz";
+    sha256 = "0qcn3yvyz0h419fjg9nb20csfmwmh3ihz0zb0jfzdycf5w4mlry6";
+  };
+
+  useDune2 = true;
+  minimumOCamlVersion = "4.04";
+
+  propagatedBuildInputs = [
+    angstrom
+    faraday
+  ];
+
+  # circular dependency
+  doCheck = false;
+
+  meta = {
+    license = lib.licenses.bsd3;
+    description = "An HPACK (Header Compression for HTTP/2) implementation in OCaml";
+    homepage = "https://github.com/anmonteiro/ocaml-h2";
+    maintainers = with lib.maintainers; [
+      sternenseemann
+      anmonteiro
+    ];
+  };
+}