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