1{
2 lib,
3 ocaml,
4 version ? if lib.versionAtLeast ocaml.version "5.1" then "2.7.0" else "0.9",
5 buildDunePackage,
6 cstruct,
7 dune-configurator,
8 fetchurl,
9 fmt,
10 optint,
11 mdx,
12}:
13
14let
15 param =
16 {
17 "0.9" = {
18 minimalOCamlVersion = "4.12";
19 hash = "sha256-eXWIxfL9UsKKf4sanBjKfr6Od4fPDctVnkU+wjIXW0M=";
20 };
21 "2.7.0" = {
22 minimalOCamlVersion = "5.1.0";
23 hash = "sha256-mePi6/TXtxgtLYLyHRAdnRcgeldCVgUaPY+MZXSzC6U=";
24 };
25 }
26 .${version};
27in
28buildDunePackage rec {
29 pname = "uring";
30 inherit version;
31 inherit (param) minimalOCamlVersion;
32
33 src = fetchurl {
34 url = "https://github.com/ocaml-multicore/ocaml-${pname}/releases/download/v${version}/${pname}-${version}.tbz";
35 inherit (param) hash;
36 };
37
38 propagatedBuildInputs = [
39 cstruct
40 fmt
41 optint
42 ];
43
44 buildInputs = [
45 dune-configurator
46 ];
47
48 checkInputs = [
49 mdx
50 ];
51
52 nativeCheckInputs = [
53 mdx.bin
54 ];
55
56 # Tests use io_uring, which is blocked by Lix's sandbox because it's
57 # opaque to seccomp.
58 doCheck = false;
59
60 dontStrip = true;
61
62 meta = {
63 homepage = "https://github.com/ocaml-multicore/ocaml-${pname}";
64 changelog = "https://github.com/ocaml-multicore/ocaml-${pname}/raw/v${version}/CHANGES.md";
65 description = "Bindings to io_uring for OCaml";
66 license = with lib.licenses; [
67 isc
68 mit
69 ];
70 platforms = lib.platforms.linux;
71 maintainers = with lib.maintainers; [ toastal ];
72 };
73}