nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 fetchurl,
4 buildDunePackage,
5 ocaml,
6 ppx_sexp_conv,
7 base64,
8 jsonm,
9 http,
10 logs,
11 re,
12 stringext,
13 ipaddr,
14 uri-sexp,
15 fmt,
16 alcotest,
17 crowbar,
18}:
19
20buildDunePackage (finalAttrs: {
21 pname = "cohttp";
22 version = if lib.versionAtLeast ocaml.version "4.13" then "6.2.1" else "5.3.1";
23
24 minimalOCamlVersion = "4.08";
25
26 src = fetchurl {
27 url = "https://github.com/mirage/ocaml-cohttp/releases/download/v${finalAttrs.version}/cohttp-${finalAttrs.version}.tbz";
28 hash =
29 {
30 "6.2.1" = "sha256-ZQgCR3Y0QtHcPNkGeLgjO3mHcvA2rIHNHqreH11mpl8=";
31 "5.3.1" = "sha256-9eJz08Lyn/R71+Ftsj4fPWzQGkC+ACCJhbxDTIjUV2s=";
32 }
33 ."${finalAttrs.version}";
34 };
35
36 postPatch = ''
37 substituteInPlace cohttp/src/dune --replace 'bytes base64' 'base64'
38 '';
39
40 buildInputs = [
41 ppx_sexp_conv
42 ]
43 ++ lib.optionals (lib.versionOlder finalAttrs.version "6.0.0") [
44 jsonm
45 ];
46
47 propagatedBuildInputs = [
48 base64
49 re
50 stringext
51 uri-sexp
52 ]
53 ++ lib.optionals (lib.versionAtLeast finalAttrs.version "6.0.0") [
54 http
55 ipaddr
56 logs
57 ];
58
59 doCheck = true;
60 checkInputs = [
61 fmt
62 alcotest
63 ]
64 ++ lib.optionals (lib.versionOlder finalAttrs.version "6.0.0") [
65 crowbar
66 ];
67
68 meta = {
69 description = "HTTP(S) library for Lwt, Async and Mirage";
70 license = lib.licenses.isc;
71 maintainers = [ lib.maintainers.vbgl ];
72 homepage = "https://github.com/mirage/ocaml-cohttp";
73 };
74})