nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildDunePackage,
4 fetchFromGitHub,
5 fetchpatch,
6 ocaml,
7 ppxlib,
8 ounit,
9 ounit2,
10 ppx_deriving,
11 result,
12 yojson,
13}:
14
15let
16 param =
17 if lib.versionAtLeast ppxlib.version "0.36" then
18 {
19 version = "3.10.0";
20 sha256 = "sha256-Dy9egNpZdxsTPLo2mbpiFTMh5cYUXXOlOZLlQJuAK+E=";
21 checkInputs = [ ounit2 ];
22 }
23 else if lib.versionAtLeast ppxlib.version "0.30" then
24 {
25 version = "3.9.0";
26 sha256 = "sha256-0d6YcBkeFoHXffCYjLIIvruw8B9ZB6NbUijhTv9uyN8=";
27 checkInputs = [ ounit2 ];
28 }
29 else
30 {
31 version = "3.6.1";
32 sha256 = "1icz5h6p3pfj7my5gi7wxpflrb8c902dqa17f9w424njilnpyrbk";
33 checkInputs = [ ounit ];
34 propagatedBuildInputs = [ result ];
35 };
36in
37
38buildDunePackage rec {
39 pname = "ppx_deriving_yojson";
40 inherit (param) version;
41
42 patches = fetchpatch {
43 url = "https://github.com/ocaml-ppx/ppx_deriving_yojson/commit/1bbbe2c4c5822c4297b0b812c59a155cf96c5089.patch";
44 hash = "sha256-jYW2/Ix6T94vfI2mGnIkYSG1rjsWEsnOPA1mufP3sd4=";
45 };
46
47 src = fetchFromGitHub {
48 owner = "ocaml-ppx";
49 repo = "ppx_deriving_yojson";
50 rev = "v${version}";
51 inherit (param) sha256;
52 };
53
54 propagatedBuildInputs = [
55 ppxlib
56 ppx_deriving
57 yojson
58 ]
59 ++ param.propagatedBuildInputs or [ ];
60
61 doCheck = true;
62 inherit (param) checkInputs;
63
64 meta = {
65 description = "Yojson codec generator for OCaml >= 4.04";
66 inherit (src.meta) homepage;
67 license = lib.licenses.mit;
68 maintainers = [ lib.maintainers.vbgl ];
69 };
70}