1{
2 lib,
3 fetchurl,
4 buildDunePackage,
5 ocaml,
6 version ?
7 if lib.versionAtLeast ocaml.version "4.07" then
8 if lib.versionAtLeast ocaml.version "4.08" then
9 if lib.versionAtLeast ocaml.version "4.11" then
10 if lib.versionAtLeast ocaml.version "5.03" then "0.36.0" else "0.33.0"
11 else
12 "0.24.0"
13 else
14 "0.15.0"
15 else
16 "0.13.0",
17 ocaml-compiler-libs,
18 ocaml-migrate-parsetree,
19 ppx_derivers,
20 stdio,
21 stdlib-shims,
22 ocaml-migrate-parsetree-2,
23}:
24
25let
26 param =
27 {
28 "0.8.1" = {
29 sha256 = "sha256-pct57oO7qAMEtlvEfymFOCvviWaLG0b5/7NzTC8vdSE=";
30 max_version = "4.10";
31 OMP = [ ocaml-migrate-parsetree ];
32 };
33 "0.13.0" = {
34 sha256 = "sha256-geHz0whQDg5/YQjVsN2iuHlkClwh7z3Eqb2QOBzuOdk=";
35 min_version = "4.07";
36 max_version = "4.11";
37 OMP = [ ocaml-migrate-parsetree ];
38 };
39 "0.15.0" = {
40 sha256 = "sha256-C2MNf410qJmlXMJxiLXOA+c1qT8H6gwt5WUy2P2TszA=";
41 min_version = "4.07";
42 max_version = "4.12";
43 OMP = [ ocaml-migrate-parsetree ];
44 };
45 "0.18.0" = {
46 sha256 = "sha256-nUg8NkZ64GHHDfcWbtFGXq3MNEKu+nYPtcVDm/gEfcM=";
47 min_version = "4.07";
48 max_version = "4.12";
49 OMP = [ ocaml-migrate-parsetree-2 ];
50 };
51 "0.22.0" = {
52 sha256 = "sha256-PuuR4DlmZiKEoyIuYS3uf0+it2N8U9lXLSp0E0u5bXo=";
53 min_version = "4.07";
54 max_version = "4.13";
55 OMP = [ ocaml-migrate-parsetree-2 ];
56 };
57 "0.22.2" = {
58 sha256 = "sha256-0Oih69xiILFXTXqSbwCEYMURjM73m/mgzgJC80z/Ilo=";
59 min_version = "4.07";
60 max_version = "4.14";
61 OMP = [ ocaml-migrate-parsetree-2 ];
62 };
63 "0.23.0" = {
64 sha256 = "sha256-G1g2wYa51aFqz0falPOWj08ItRm3cpzYao/TmXH+EuU=";
65 min_version = "4.07";
66 max_version = "4.14";
67 };
68 "0.24.0" = {
69 sha256 = "sha256-d2YCfC7ND1s7Rg6SEqcHCcZ0QngRPrkfMXxWxB56kMg=";
70 min_version = "4.07";
71 max_version = "5.1";
72 };
73 "0.28.0" = {
74 sha256 = "sha256-2Hrl+aCBIGMIypZICbUKZq646D0lSAHouWdUSLYM83c=";
75 min_version = "4.07";
76 max_version = "5.1";
77 };
78 "0.30.0" = {
79 sha256 = "sha256-3UpjvenSm0mBDgTXZTk3yTLxd6lByg4ZgratU6xEIRA=";
80 min_version = "4.07";
81 };
82 "0.32.1" = {
83 sha256 = "sha256-nbrYvLHItPPfP1i8pgpe0j2GUx8No0tBlshr1YXAnX8=";
84 min_version = "4.07";
85 };
86 "0.33.0" = {
87 sha256 = "sha256-/6RO9VHyO3XiHb1pijAxBDE4Gq8UC5/kuBwucKLSxjo=";
88 min_version = "4.07";
89 };
90 "0.36.0" = {
91 sha256 = "sha256-WrobzhTFMQhhQTARDIQ9AEv5O9LPOgd4/XCGuFOQpDQ=";
92 min_version = "4.08";
93 };
94 }
95 ."${version}";
96in
97
98if
99 param ? max_version && lib.versionAtLeast ocaml.version param.max_version
100 || param ? min_version && lib.versionOlder ocaml.version param.min_version
101then
102 throw "ppxlib-${version} is not available for OCaml ${ocaml.version}"
103else
104
105 buildDunePackage rec {
106 pname = "ppxlib";
107 inherit version;
108
109 src = fetchurl {
110 url = "https://github.com/ocaml-ppx/ppxlib/releases/download/${version}/ppxlib-${version}.tbz";
111 inherit (param) sha256;
112 };
113
114 propagatedBuildInputs = [
115 ocaml-compiler-libs
116 ]
117 ++ (param.OMP or [ ])
118 ++ [
119 ppx_derivers
120 stdio
121 stdlib-shims
122 ];
123
124 meta = {
125 description = "Comprehensive ppx tool set";
126 license = lib.licenses.mit;
127 maintainers = [ lib.maintainers.vbgl ];
128 homepage = "https://github.com/ocaml-ppx/ppxlib";
129 };
130 }