summaryrefslogtreecommitdiffstats
path: root/pkgs/development/ocaml-modules/eio/default.nix
blob: 214b14d69954bdb3c275bc4b31075d6edd8ceda6 (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
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
{
  lib,
  ocaml,
  version ?
    if lib.versionAtLeast ocaml.version "5.2" then
      "1.5"
    else if lib.versionAtLeast ocaml.version "5.1" then
      "1.2"
    else
      "0.12",
  buildDunePackage,
  dune-configurator,
  bigstringaf,
  cstruct,
  domain-local-await,
  fetchurl,
  fmt,
  hmap,
  lwt-dllist,
  mtime,
  optint,
  psq,
  alcotest,
  crowbar,
  mdx,
}:

let
  param =
    {
      "0.12" = {
        minimalOCamlVersion = "5.0";
        hash = "sha256-2EhHzoX/t4ZBSWrSS+PGq1zCxohc7a1q4lfsrFnZJqA=";
      };
      "1.2" = {
        minimalOCamlVersion = "5.1";
        hash = "sha256-N5LpEr2NSUuy449zCBgl5NISsZcM8sHxspZsqp/WvEA=";
      };
      "1.5" = {
        minimalOCamlVersion = "5.2";
        hash = "sha256-fXDR9fsrcZC/GrKP/+snLaUf/m1snHyU4Ehfq987P9o=";
      };
    }
    ."${version}";
in
buildDunePackage (finalAttrs: {
  pname = "eio";
  inherit version;
  inherit (param) minimalOCamlVersion;

  src = fetchurl {
    url = "https://github.com/ocaml-multicore/eio/releases/download/v${version}/eio-${version}.tbz";
    inherit (param) hash;
  };

  buildInputs = lib.optional (lib.versionAtLeast finalAttrs.version "1.4") dune-configurator;

  propagatedBuildInputs = [
    bigstringaf
    cstruct
    domain-local-await
    fmt
    hmap
    lwt-dllist
    mtime
    optint
    psq
  ];

  checkInputs = [
    alcotest
    crowbar
    mdx
  ];

  nativeCheckInputs = [
    mdx.bin
  ];

  doCheck = lib.versionAtLeast ocaml.version "5.1";

  meta = {
    homepage = "https://github.com/ocaml-multicore/eio";
    changelog = "https://github.com/ocaml-multicore/eio/raw/v${version}/CHANGES.md";
    description = "Effects-Based Parallel IO for OCaml";
    license = lib.licenses.isc;
    maintainers = with lib.maintainers; [ toastal ];
  };
})