From eec3d569de67da301edca557b78c093659e86fe0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marijan=20Petri=C4=8Devi=C4=87?= Date: Tue, 27 May 2025 15:08:08 -0500 Subject: [PATCH] ocamlPackages.cohttp: 5.3.1 -> 6.2.0 --- .../ocaml-modules/cohttp/default.nix | 29 +++++++++++++++---- .../development/ocaml-modules/cohttp/http.nix | 21 ++++++++++++++ pkgs/development/ocaml-modules/cohttp/lwt.nix | 2 ++ pkgs/top-level/ocaml-packages.nix | 7 +++++ 4 files changed, 53 insertions(+), 6 deletions(-) create mode 100644 pkgs/development/ocaml-modules/cohttp/http.nix diff --git a/pkgs/development/ocaml-modules/cohttp/default.nix b/pkgs/development/ocaml-modules/cohttp/default.nix index 8a3d0bd88f23..6a277a913854 100644 --- a/pkgs/development/ocaml-modules/cohttp/default.nix +++ b/pkgs/development/ocaml-modules/cohttp/default.nix @@ -5,23 +5,31 @@ ppx_sexp_conv, base64, jsonm, + http, + logs, re, stringext, + ipaddr, uri-sexp, fmt, alcotest, crowbar, }: -buildDunePackage rec { +buildDunePackage (finalAttrs: { pname = "cohttp"; - version = "5.3.1"; + version = "6.2.0"; minimalOCamlVersion = "4.08"; src = fetchurl { - url = "https://github.com/mirage/ocaml-cohttp/releases/download/v${version}/cohttp-${version}.tbz"; - hash = "sha256-9eJz08Lyn/R71+Ftsj4fPWzQGkC+ACCJhbxDTIjUV2s="; + url = "https://github.com/mirage/ocaml-cohttp/releases/download/v${finalAttrs.version}/cohttp-${finalAttrs.version}.tbz"; + hash = + { + "6.2.0" = "sha256-bwV1TK8z1rdeii4aISDKe1Ag4TiLwgJIRC0TOZNt3zs="; + "5.3.1" = "sha256-9eJz08Lyn/R71+Ftsj4fPWzQGkC+ACCJhbxDTIjUV2s="; + } + ."${finalAttrs.version}"; }; postPatch = '' @@ -29,8 +37,10 @@ buildDunePackage rec { ''; buildInputs = [ - jsonm ppx_sexp_conv + ] + ++ lib.optionals (lib.versionOlder finalAttrs.version "6.0.0") [ + jsonm ]; propagatedBuildInputs = [ @@ -38,12 +48,19 @@ buildDunePackage rec { re stringext uri-sexp + ] + ++ lib.optionals (lib.versionAtLeast finalAttrs.version "6.0.0") [ + http + ipaddr + logs ]; doCheck = true; checkInputs = [ fmt alcotest + ] + ++ lib.optionals (lib.versionOlder finalAttrs.version "6.0.0") [ crowbar ]; @@ -53,4 +70,4 @@ buildDunePackage rec { maintainers = [ lib.maintainers.vbgl ]; homepage = "https://github.com/mirage/ocaml-cohttp"; }; -} +}) diff --git a/pkgs/development/ocaml-modules/cohttp/http.nix b/pkgs/development/ocaml-modules/cohttp/http.nix new file mode 100644 index 000000000000..774b7a134813 --- /dev/null +++ b/pkgs/development/ocaml-modules/cohttp/http.nix @@ -0,0 +1,21 @@ +{ + buildDunePackage, + cohttp, + ppx_expect, +}: + +buildDunePackage { + pname = "http"; + inherit (cohttp) + version + src + ; + + minimalOCamlVersion = "5.1"; + + propagatedBuildInputs = [ ppx_expect ]; + + meta = cohttp.meta // { + description = "CoHTTP implementation using the Lwt concurrency library"; + }; +} diff --git a/pkgs/development/ocaml-modules/cohttp/lwt.nix b/pkgs/development/ocaml-modules/cohttp/lwt.nix index 4471ae205b1a..1ecd7569ed37 100644 --- a/pkgs/development/ocaml-modules/cohttp/lwt.nix +++ b/pkgs/development/ocaml-modules/cohttp/lwt.nix @@ -1,6 +1,7 @@ { buildDunePackage, cohttp, + ipaddr, lwt, uri, ppx_sexp_conv, @@ -21,6 +22,7 @@ buildDunePackage { propagatedBuildInputs = [ cohttp + ipaddr lwt logs sexplib0 diff --git a/pkgs/top-level/ocaml-packages.nix b/pkgs/top-level/ocaml-packages.nix index 7635223d55dc..30d1068f2b0a 100644 --- a/pkgs/top-level/ocaml-packages.nix +++ b/pkgs/top-level/ocaml-packages.nix @@ -254,6 +254,11 @@ let cohttp = callPackage ../development/ocaml-modules/cohttp { }; + cohttp_5_3 = cohttp.overrideAttrs (_: { + version = "5.3.1"; + __intentionallyOverridingVersion = true; + }); + cohttp-async = callPackage ../development/ocaml-modules/cohttp/async.nix { }; cohttp-lwt = callPackage ../development/ocaml-modules/cohttp/lwt.nix { }; @@ -789,6 +794,8 @@ let hpack = callPackage ../development/ocaml-modules/hpack { }; + http = callPackage ../development/ocaml-modules/cohttp/http.nix { }; + http-mirage-client = callPackage ../development/ocaml-modules/http-mirage-client { }; httpaf = callPackage ../development/ocaml-modules/httpaf { };