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
|
{
lib,
stdenv,
fetchurl,
buildDunePackage,
ocaml,
findlib,
alcotest,
astring,
cmdliner,
cppo,
fmt,
logs,
ocaml-version,
camlp-streams,
lwt,
re,
result,
csexp,
gitUpdater,
}:
buildDunePackage (finalAttrs: {
pname = "mdx";
version = "2.5.2";
src = fetchurl {
url = "https://github.com/realworldocaml/mdx/releases/download/${finalAttrs.version}/mdx-${finalAttrs.version}.tbz";
hash = "sha256-yEjCxoDGJmLcSgX1WOXGwY7Sqre7ZQjB1JEJ1uqRo88=";
};
env =
# Fix build with gcc15
lib.optionalAttrs
(
lib.versionAtLeast ocaml.version "4.10" && lib.versionOlder ocaml.version "4.14"
|| lib.versions.majorMinor ocaml.version == "5.0"
)
{
NIX_CFLAGS_COMPILE = "-std=gnu11";
};
nativeBuildInputs = [ cppo ];
propagatedBuildInputs = [
astring
fmt
logs
csexp
cmdliner
ocaml-version
camlp-streams
re
result
findlib
];
checkInputs = [
alcotest
lwt
];
doCheck = !stdenv.hostPlatform.isDarwin;
outputs = [
"bin"
"lib"
"out"
];
installPhase = ''
runHook preInstall
dune install --prefix=$bin --libdir=$lib/lib/ocaml/${ocaml.version}/site-lib mdx
runHook postInstall
'';
passthru.updateScript = gitUpdater { };
meta = {
description = "Executable OCaml code blocks inside markdown files";
homepage = "https://github.com/realworldocaml/mdx";
changelog = "https://github.com/realworldocaml/mdx/raw/${finalAttrs.version}/CHANGES.md";
license = lib.licenses.isc;
maintainers = [ lib.maintainers.romildo ];
mainProgram = "ocaml-mdx";
};
})
|