2018-07-14 11:26:50 +03:00
|
|
|
{ stdenv, ocaml, findlib, ocamlbuild, fetchzip
|
2017-08-28 12:17:22 +03:00
|
|
|
, cppo, ppx_tools, ppx_derivers, result, ounit, ocaml-migrate-parsetree
|
2017-03-04 08:24:36 +03:00
|
|
|
}:
|
2016-09-14 00:50:18 +03:00
|
|
|
|
2018-07-14 11:26:50 +03:00
|
|
|
if !stdenv.lib.versionAtLeast ocaml.version "4.02"
|
|
|
|
then throw "ppx_deriving is not available for OCaml ${ocaml.version}"
|
|
|
|
else
|
|
|
|
|
2017-08-28 12:17:22 +03:00
|
|
|
let param =
|
|
|
|
if ocaml.version == "4.03.0"
|
|
|
|
then {
|
|
|
|
version = "4.1";
|
|
|
|
sha256 = "0cy9p8d8cbcxvqyyv8fz2z9ypi121zrgaamdlp4ld9f3jnwz7my9";
|
|
|
|
extraPropagatedBuildInputs = [];
|
|
|
|
} else {
|
2017-11-22 02:29:07 +03:00
|
|
|
version = "4.2.1";
|
|
|
|
sha256 = "1yhhjnncbbb7fsif7qplndh01s1xd72dqm8f3jkgx9y4ariqqvf9";
|
2017-08-28 12:17:22 +03:00
|
|
|
extraPropagatedBuildInputs = [ ocaml-migrate-parsetree ppx_derivers ];
|
|
|
|
}; in
|
|
|
|
|
2018-07-14 11:26:50 +03:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "ocaml${ocaml.version}-ppx_deriving-${version}";
|
2017-08-28 12:17:22 +03:00
|
|
|
inherit (param) version;
|
2016-09-14 00:50:18 +03:00
|
|
|
|
2017-03-04 08:24:36 +03:00
|
|
|
src = fetchzip {
|
2018-07-14 11:26:50 +03:00
|
|
|
url = "https://github.com/ocaml-ppx/ppx_deriving/archive/v${version}.tar.gz";
|
2017-08-28 12:17:22 +03:00
|
|
|
inherit (param) sha256;
|
2016-09-14 00:50:18 +03:00
|
|
|
};
|
|
|
|
|
2018-07-14 11:26:50 +03:00
|
|
|
buildInputs = [ ocaml findlib ocamlbuild cppo ounit ];
|
2017-08-28 12:17:22 +03:00
|
|
|
propagatedBuildInputs = param.extraPropagatedBuildInputs ++
|
2016-09-14 00:50:18 +03:00
|
|
|
[ ppx_tools result ];
|
|
|
|
|
2018-07-14 11:26:50 +03:00
|
|
|
createFindlibDestdir = true;
|
|
|
|
|
2016-09-14 00:50:18 +03:00
|
|
|
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;
|
|
|
|
};
|
|
|
|
}
|