1{
2 lib,
3 ocaml,
4 version ?
5 if lib.versionAtLeast ocaml.version "5.2" then
6 "1.3"
7 else if lib.versionAtLeast ocaml.version "5.1" then
8 "1.2"
9 else
10 "0.12",
11 buildDunePackage,
12 bigstringaf,
13 cstruct,
14 domain-local-await,
15 fetchurl,
16 fmt,
17 hmap,
18 lwt-dllist,
19 mtime,
20 optint,
21 psq,
22 alcotest,
23 crowbar,
24 mdx,
25}:
26
27let
28 param =
29 {
30 "0.12" = {
31 minimalOCamlVersion = "5.0";
32 hash = "sha256-2EhHzoX/t4ZBSWrSS+PGq1zCxohc7a1q4lfsrFnZJqA=";
33 };
34 "1.2" = {
35 minimalOCamlVersion = "5.1";
36 hash = "sha256-N5LpEr2NSUuy449zCBgl5NISsZcM8sHxspZsqp/WvEA=";
37 };
38 "1.3" = {
39 minimalOCamlVersion = "5.2";
40 hash = "sha256-jtXBPmaJ8xyF3KXxJ2LYS4zABCp7B9PkZN9utLcrPfw=";
41 };
42 }
43 ."${version}";
44in
45buildDunePackage rec {
46 pname = "eio";
47 inherit version;
48 inherit (param) minimalOCamlVersion;
49
50 src = fetchurl {
51 url = "https://github.com/ocaml-multicore/${pname}/releases/download/v${version}/${pname}-${version}.tbz";
52 inherit (param) hash;
53 };
54
55 propagatedBuildInputs = [
56 bigstringaf
57 cstruct
58 domain-local-await
59 fmt
60 hmap
61 lwt-dllist
62 mtime
63 optint
64 psq
65 ];
66
67 checkInputs = [
68 alcotest
69 crowbar
70 mdx
71 ];
72
73 nativeCheckInputs = [
74 mdx.bin
75 ];
76
77 meta = {
78 homepage = "https://github.com/ocaml-multicore/${pname}";
79 changelog = "https://github.com/ocaml-multicore/${pname}/raw/v${version}/CHANGES.md";
80 description = "Effects-Based Parallel IO for OCaml";
81 license = with lib.licenses; [ isc ];
82 maintainers = with lib.maintainers; [ toastal ];
83 };
84}