1{
2 lib,
3 fetchzip,
4 topkg,
5 buildTopkgPackage,
6 withBrr ? true,
7 brr,
8 withBytesrw ? true,
9 bytesrw,
10 withCmdliner ? true,
11 cmdliner,
12}:
13
14buildTopkgPackage rec {
15 pname = "jsont";
16 version = "0.2.0";
17
18 minimalOCamlVersion = "4.14.0";
19
20 src = fetchzip {
21 url = "https://erratique.ch/software/jsont/releases/jsont-${version}.tbz";
22 hash = "sha256-dXHl+bLuIrlrQ5Np37+uVuETFBb3j8XeDVEK9izoQFk=";
23 };
24
25 buildInputs = lib.optional withCmdliner cmdliner;
26
27 propagatedBuildInputs = lib.optional withBrr brr ++ lib.optional withBytesrw bytesrw;
28
29 buildPhase = "${topkg.run} build ${
30 lib.escapeShellArgs [
31 "--with-brr"
32 (lib.boolToString withBrr)
33
34 "--with-bytesrw"
35 (lib.boolToString withBytesrw)
36
37 "--with-cmdliner"
38 (lib.boolToString withCmdliner)
39 ]
40 }";
41
42 meta = {
43 description = "Declarative JSON data manipulation";
44 longDescription = ''
45 Jsont is an OCaml library for declarative JSON data manipulation. it
46 provides:
47
48 • Combinators for describing JSON data using the OCaml values of your
49 choice. The descriptions can be used by generic functions to decode,
50 encode, query and update JSON data without having to construct a
51 generic JSON representation
52 • A JSON codec with optional text location tracking and best-effort
53 layout preservation. The codec is compatible with effect-based
54 concurrency.
55
56 The descriptions are independent from the codec and can be used by
57 third-party processors or codecs.
58 '';
59 homepage = "https://erratique.ch/software/jsont";
60 license = lib.licenses.isc;
61 maintainers = with lib.maintainers; [ toastal ];
62 };
63}