summary refs log tree commit diff
path: root/pkgs/development/ocaml-modules/curly/default.nix
blob: 35e275f52f1b1fce0d67be048092dc64e958cd2e (plain) (blame)
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
{ stdenv, lib, buildDunePackage, fetchurl, ocaml
, result, alcotest, cohttp-lwt-unix, odoc, curl, cacert
}:

buildDunePackage rec {
  pname = "curly";
  version = "0.2.0";

  minimalOCamlVersion = "4.02";

  duneVersion = "3";

  src = fetchurl {
    url = "https://github.com/rgrinberg/curly/releases/download/${version}/curly-${version}.tbz";
    hash = "sha256-01D1+03CqxLrPoBbNWpSKOzABJf63DhQLA1kRWdueB8=";
  };

  propagatedBuildInputs = [ result ];
  checkInputs = [ alcotest cohttp-lwt-unix cacert ];
  # test dependencies are only available for >= 4.08
  # https://github.com/mirage/ca-certs/issues/16
  doCheck = lib.versionAtLeast ocaml.version "4.08"
    # Some test fails in macOS sandbox
    # > Fatal error: exception Unix.Unix_error(Unix.EPERM, "bind", "")
    && !stdenv.isDarwin;

  postPatch = ''
    substituteInPlace src/curly.ml \
      --replace "exe=\"curl\"" "exe=\"${curl}/bin/curl\""
    '';

  meta = with lib; {
    description = "Curly is a brain dead wrapper around the curl command line utility";
    homepage = "https://github.com/rgrinberg/curly";
    license = licenses.isc;
    maintainers = [ maintainers.sternenseemann ];
  };
}