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