Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib
2, fetchurl
3, buildDunePackage
4, ocaml
5, findlib
6, cppo
7, ppxlib
8, ppx_derivers
9, result
10, ounit
11, ounit2
12, ocaml-migrate-parsetree
13, ocaml-migrate-parsetree-2
14}:
15
16let params =
17 if lib.versionAtLeast ppxlib.version "0.20" then {
18 version = "5.2.1";
19 sha256 = "11h75dsbv3rs03pl67hdd3lbim7wjzh257ij9c75fcknbfr5ysz9";
20 useOMP2 = true;
21 } else if lib.versionAtLeast ppxlib.version "0.15" then {
22 version = "5.1";
23 sha256 = "1i64fd7qrfzbam5hfbl01r0sx4iihsahcwqj13smmrjlnwi3nkxh";
24 useOMP2 = false;
25 } else {
26 version = "5.0";
27 sha256 = "0fkzrn4pdyvf1kl0nwvhqidq01pnq3ql8zk1jd56hb0cxaw851w3";
28 useOMP2 = false;
29 }
30; in
31
32buildDunePackage rec {
33 pname = "ppx_deriving";
34 inherit (params) version;
35
36 duneVersion = "3";
37
38 src = fetchurl {
39 url = "https://github.com/ocaml-ppx/ppx_deriving/releases/download/v${version}/ppx_deriving-v${version}.tbz";
40 inherit (params) sha256;
41 };
42
43 strictDeps = true;
44
45 nativeBuildInputs = [ cppo ];
46 buildInputs = [ findlib ppxlib ];
47 propagatedBuildInputs = [
48 (if params.useOMP2
49 then ocaml-migrate-parsetree-2
50 else ocaml-migrate-parsetree)
51 ppx_derivers
52 result
53 ];
54
55 doCheck = lib.versionAtLeast ocaml.version "4.08"
56 && lib.versionOlder ocaml.version "5.0";
57 checkInputs = [
58 (if lib.versionAtLeast version "5.2" then ounit2 else ounit)
59 ];
60
61 meta = with lib; {
62 description = "deriving is a library simplifying type-driven code generation on OCaml >=4.02.";
63 maintainers = [ maintainers.maurer ];
64 license = licenses.mit;
65 };
66}