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