aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/nixpkgs/pkgs/development/ocaml-modules/curly/default.nix
blob: 236b9c19c928adec62fc8c3180f49d6ac8c5dfaa (plain)
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
{ stdenv, buildDunePackage, fetchurl, ocaml
, result, alcotest, cohttp-lwt-unix, odoc, curl }:

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

  minimumOCamlVersion = "4.02";

  useDune2 = true;

  src = fetchurl {
    url = "https://github.com/rgrinberg/curly/releases/download/${version}/curly-${version}.tbz";
    sha256 = "07vqdrklar0d5i83ip7sjw2c1v18a9m3anw07vmi5ay29pxzal6k";
  };

  propagatedBuildInputs = [ result ];
  checkInputs = [ alcotest cohttp-lwt-unix ];
  # test dependencies are only available for >= 4.08
  doCheck = stdenv.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\""
    '';
}