nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenv,
3 lib,
4 buildDunePackage,
5 fetchurl,
6 ocaml,
7 result,
8 alcotest,
9 cohttp-lwt-unix,
10 curl,
11 cacert,
12}:
13
14buildDunePackage rec {
15 pname = "curly";
16 version = "0.3.0";
17
18 minimalOCamlVersion = "4.03";
19
20 duneVersion = "3";
21
22 src = fetchurl {
23 url = "https://github.com/rgrinberg/curly/releases/download/${version}/curly-${version}.tbz";
24 hash = "sha256-Qn/PKBNOcMt3dk2f7uJD8x0yo4RHobXSjTQck7fcXTw=";
25 };
26
27 propagatedBuildInputs = [ result ];
28 nativeCheckInputs = [ cacert ];
29 checkInputs = [
30 alcotest
31 cohttp-lwt-unix
32 ];
33 # test dependencies are only available for >= 4.08
34 # https://github.com/mirage/ca-certs/issues/16
35 doCheck =
36 lib.versionAtLeast ocaml.version "4.08"
37 # Some test fails in macOS sandbox
38 # > Fatal error: exception Unix.Unix_error(Unix.EPERM, "bind", "")
39 && !stdenv.hostPlatform.isDarwin;
40
41 postPatch = ''
42 substituteInPlace src/curly.ml \
43 --replace "exe=\"curl\"" "exe=\"${curl}/bin/curl\""
44 substituteInPlace test/test_curly.ml \
45 --replace-fail "let body_header b = [\"content-length\", string_of_int (String.length b)]" \
46 "let body_header b = [\"connection\", \"keep-alive\"; \"content-length\", string_of_int (String.length b)]"
47 '';
48
49 meta = {
50 description = "Curly is a brain dead wrapper around the curl command line utility";
51 homepage = "https://github.com/rgrinberg/curly";
52 license = lib.licenses.isc;
53 maintainers = [ lib.maintainers.sternenseemann ];
54 };
55}