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