1{
2 lib,
3 fetchurl,
4 buildDunePackage,
5 ocaml,
6 findlib,
7 alcotest,
8 astring,
9 cppo,
10 fmt,
11 logs,
12 ocaml-version,
13 camlp-streams,
14 lwt,
15 re,
16 csexp,
17 gitUpdater,
18}:
19
20buildDunePackage rec {
21 pname = "mdx";
22 version = "2.5.0";
23
24 minimalOCamlVersion = "4.08";
25
26 src = fetchurl {
27 url = "https://github.com/realworldocaml/mdx/releases/download/${version}/mdx-${version}.tbz";
28 hash = "sha256-wtpY19UYLxXARvsyC7AsFmAtLufLmfNJ4/SEHCY2UCk=";
29 };
30
31 nativeBuildInputs = [ cppo ];
32 propagatedBuildInputs = [
33 astring
34 fmt
35 logs
36 csexp
37 ocaml-version
38 camlp-streams
39 re
40 findlib
41 ];
42 checkInputs = [
43 alcotest
44 lwt
45 ];
46
47 doCheck = true;
48
49 outputs = [
50 "bin"
51 "lib"
52 "out"
53 ];
54
55 installPhase = ''
56 runHook preInstall
57 dune install --prefix=$bin --libdir=$lib/lib/ocaml/${ocaml.version}/site-lib ${pname}
58 runHook postInstall
59 '';
60
61 passthru.updateScript = gitUpdater { };
62
63 meta = {
64 description = "Executable OCaml code blocks inside markdown files";
65 homepage = "https://github.com/realworldocaml/mdx";
66 changelog = "https://github.com/realworldocaml/mdx/raw/${version}/CHANGES.md";
67 license = lib.licenses.isc;
68 maintainers = [ lib.maintainers.romildo ];
69 mainProgram = "ocaml-mdx";
70 };
71}