1{ lib
2, fetchurl
3, buildDunePackage
4, ocaml
5, ounit
6, ppx_deriving
7, ppx_sexp_conv
8, ppxlib
9, version ? if lib.versionAtLeast ocaml.version "4.11" then "1.10.0" else "1.9.1"
10}:
11
12let param = {
13 "1.9.1" = {
14 sha256 = "sha256-0bSY4u44Ds84XPIbcT5Vt4AG/4PkzFKMl9CDGFZyIdI=";
15 };
16 "1.10.0" = {
17 sha256 = "sha256-MA8sf0F7Ch1wJDL8E8470ukKx7KieWyjWJnJQsqBVW8=";
18 };
19}."${version}"; in
20
21lib.throwIfNot (lib.versionAtLeast ppxlib.version "0.24.0")
22 "ppx_import is not available with ppxlib-${ppxlib.version}"
23
24buildDunePackage rec {
25 pname = "ppx_import";
26 inherit version;
27
28 minimalOCamlVersion = "4.05";
29 duneVersion = "3";
30
31 src = fetchurl {
32 url = "https://github.com/ocaml-ppx/ppx_import/releases/download/${version}/ppx_import-${version}.tbz";
33 inherit (param) sha256;
34 };
35
36 propagatedBuildInputs = [
37 ppxlib
38 ];
39
40 checkInputs = [
41 ounit
42 ppx_deriving
43 ppx_sexp_conv
44 ];
45
46 doCheck = true;
47
48 meta = {
49 description = "A syntax extension for importing declarations from interface files";
50 license = lib.licenses.mit;
51 homepage = "https://github.com/ocaml-ppx/ppx_import";
52 };
53}