2018-11-06 17:18:09 +01:00
|
|
|
{ stdenv, fetchurl, ocaml, findlib, dune, opaline }:
|
2018-11-05 11:21:46 +01:00
|
|
|
|
|
|
|
{ pname, version, buildInputs ? [], ... }@args:
|
|
|
|
|
|
|
|
if args ? minimumOCamlVersion &&
|
|
|
|
! stdenv.lib.versionAtLeast ocaml.version args.minimumOCamlVersion
|
|
|
|
then throw "${pname}-${version} is not available for OCaml ${ocaml.version}"
|
|
|
|
else
|
|
|
|
|
|
|
|
stdenv.mkDerivation ({
|
|
|
|
|
2018-11-05 13:58:01 +01:00
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
dune build -p ${pname}
|
|
|
|
runHook postBuild
|
|
|
|
'';
|
|
|
|
checkPhase = ''
|
|
|
|
runHook preCheck
|
|
|
|
dune runtest -p ${pname}
|
|
|
|
runHook postCheck
|
|
|
|
'';
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
2018-11-06 17:18:09 +01:00
|
|
|
${opaline}/bin/opaline -prefix $out -libdir $OCAMLFIND_DESTDIR
|
2018-11-05 13:58:01 +01:00
|
|
|
runHook postInstall
|
|
|
|
'';
|
2018-11-05 11:21:46 +01:00
|
|
|
|
|
|
|
} // args // {
|
|
|
|
|
|
|
|
name = "ocaml${ocaml.version}-${pname}-${version}";
|
|
|
|
|
|
|
|
buildInputs = [ ocaml dune findlib ] ++ buildInputs;
|
|
|
|
|
2018-11-27 16:30:55 +01:00
|
|
|
meta = (args.meta or {}) // { platforms = args.meta.platforms or ocaml.meta.platforms; };
|
|
|
|
|
2018-11-05 11:21:46 +01:00
|
|
|
})
|