1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
|
{
description = "Cohttp Nix Flake";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.nixpkgs.url = "github:nix-ocaml/nix-overlays";
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
ocamlPackages = pkgs.ocaml-ng.ocamlPackages_5_4.overrideScope (oself: osuper: {
ctypes-foreign = osuper.ctypes-foreign.overrideAttrs (_: { doCheck = false; });
ctypes = osuper.ctypes.overrideAttrs (_: { doCheck = false; });
mdx = (osuper.mdx.override {
# workaround for:
# https://github.com/NixOS/nixpkgs/pull/241476/commits/1ed74f3536d29e5635d7f47a1d7b82a89f5a8077
logs = oself.logs;
}).overrideAttrs (_: { doCheck = false; });
cmdliner = osuper.cmdliner.overrideAttrs (old: rec {
version = "2.1.0";
src = pkgs.fetchFromGitHub {
owner = "dbuenzli";
repo = "cmdliner";
rev = "v${version}";
sha256 = "sha256-ebe5I77zEKoehJ55ZszV0dQP4ZDfVpGXqDsEb2qEE24=";
};
});
});
inherit (ocamlPackages) buildDunePackage;
pkg = attrs: buildDunePackage ({
version = "n/a";
src = ./. ;
duneVersion = "3";
doCheck = true;
} // attrs);
ocamlformat = pkgs.ocamlformat_0_27_0;
in
with ocamlPackages; rec {
packages = rec {
default = http;
http = pkg {
pname = "http";
propagatedBuildInputs = [ ppx_expect ];
checkInputs = [ alcotest base_quickcheck ppx_expect crowbar ];
};
cohttp = pkg {
pname = "cohttp";
checkInputs = [ fmt alcotest ];
propagatedBuildInputs = [
base64 stringext http re uri uri-sexp logs sexplib0 ppx_sexp_conv
];
};
cohttp-top = pkg {
pname = "cohttp-top";
propagatedBuildInputs = [ cohttp ];
};
cohttp-curl = pkg {
pname = "cohttp-curl";
propagatedBuildInputs = [ ocurl http stringext ];
};
cohttp-curl-lwt = pkg {
pname = "cohttp-curl-lwt";
checkInputs = [ alcotest cohttp-lwt-unix cohttp cohttp-lwt conduit-lwt ounit2 uri ];
propagatedBuildInputs = [ ocurl cohttp-curl http stringext lwt ];
__darwinAllowLocalNetworking = true;
};
cohttp-curl-async = pkg {
pname = "cohttp-curl-async";
checkInputs = [ uri fmt ounit2 alcotest cohttp-async ];
propagatedBuildInputs = [
ocurl http stringext cohttp-curl core core_unix
async_kernel async_unix
];
};
cohttp-lwt = pkg {
pname = "cohttp-lwt";
propagatedBuildInputs = [ http cohttp lwt sexplib0 ppx_sexp_conv logs uri ];
};
cohttp-lwt-jsoo = pkg {
pname = "cohttp-lwt-jsoo";
propagatedBuildInputs = [
http cohttp cohttp-lwt logs lwt lwt_ppx js_of_ocaml
js_of_ocaml-ppx js_of_ocaml-lwt
];
};
cohttp-async = pkg {
pname = "cohttp-async";
checkInputs = [ mirage-crypto ounit2 ];
propagatedBuildInputs = [
http cohttp async_kernel async_unix async base core core_unix
conduit-async magic-mime logs fmt sexplib0 ppx_sexp_conv uri
uri-sexp ipaddr
];
};
cohttp-lwt-unix = pkg {
pname = "cohttp-lwt-unix";
checkInputs = [ ounit2 ];
propagatedBuildInputs = [
http cohttp cohttp-lwt cmdliner lwt conduit-lwt
conduit-lwt-unix fmt ppx_sexp_conv magic-mime logs
];
__darwinAllowLocalNetworking = true;
};
cohttp-server-lwt-unix = pkg {
pname = "cohttp-server-lwt-unix";
checkInputs = [ lwt conduit-lwt-unix cohttp-lwt cohttp-lwt-unix ];
propagatedBuildInputs = [ http lwt ];
};
cohttp-eio = pkg {
pname = "cohttp-eio";
checkInputs = [
alcotest eio mdx ppx_here
tls-eio
mirage-crypto-rng
];
propagatedBuildInputs = [ cohttp eio logs uri fmt ptime http ];
};
cohttp-mirage = pkg {
pname = "cohttp-mirage";
propagatedBuildInputs = [
mirage-flow mirage-channel conduit conduit-mirage
mirage-kv lwt cohttp-lwt cstruct fmt astring magic-mime ppx_sexp_conv
];
};
cohttp-bench = pkg {
pname = "cohttp-bench";
buildInputs = [
core core_bench eio eio_main http cohttp cohttp-eio
cohttp-lwt-unix cohttp-server-lwt-unix cohttp-async
];
};
};
devShells.default = pkgs.mkShell {
inputsFrom = pkgs.lib.attrValues packages;
buildInputs = [ ocamlformat ] ++ (with ocamlPackages; [
ocaml-lsp
]);
};
devShells.eio = pkgs.mkShell {
inputsFrom = [ cohttp-eio ];
buildInputs = [ ocamlformat ocamlPackages.ocaml-lsp ] ++ (with pkgs; [
gmp libev nmap curl
]);
};
});
}
|