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