about summary refs log tree commit diff
path: root/pkgs/development/ocaml-modules/ppx_deriving/default.nix
blob: 3afe4149fa34318380f0e7e2cc959db5b28f12b2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{ stdenv, buildOcaml, ocaml, fetchzip
, cppo, ppx_tools, ppx_derivers, result, ounit, ocaml-migrate-parsetree
}:

let param =
  if ocaml.version == "4.03.0"
  then {
    version = "4.1";
    sha256 = "0cy9p8d8cbcxvqyyv8fz2z9ypi121zrgaamdlp4ld9f3jnwz7my9";
    extraPropagatedBuildInputs = [];
  } else {
    version = "4.2.1";
    sha256 = "1yhhjnncbbb7fsif7qplndh01s1xd72dqm8f3jkgx9y4ariqqvf9";
    extraPropagatedBuildInputs = [ ocaml-migrate-parsetree ppx_derivers ];
}; in

buildOcaml rec {
  name = "ppx_deriving";
  inherit (param) version;

  minimumSupportedOcamlVersion = "4.02";

  src = fetchzip {
    url = "https://github.com/whitequark/${name}/archive/v${version}.tar.gz";
    inherit (param) sha256;
  };

  hasSharedObjects = true;

  buildInputs = [ cppo ounit ];
  propagatedBuildInputs = param.extraPropagatedBuildInputs ++
    [ ppx_tools result ];

  installPhase = "OCAMLPATH=$OCAMLPATH:`ocamlfind printconf destdir` make install";

  meta = with stdenv.lib; {
    description = "deriving is a library simplifying type-driven code generation on OCaml >=4.02.";
    maintainers = [ maintainers.maurer ];
    license = licenses.mit;
  };
}