3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/build-support/ocaml/dune.nix
Théo Zimmermann 742bce7793
buildDunePackage: inline dune.installPhase for easier overriding
Co-authored-by: Jörg Thalheim <Mic92@users.noreply.github.com>
2018-11-07 10:08:08 +01:00

37 lines
814 B
Nix

{ stdenv, fetchurl, ocaml, findlib, dune, opaline }:
{ 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 ({
buildPhase = ''
runHook preBuild
dune build -p ${pname}
runHook postBuild
'';
checkPhase = ''
runHook preCheck
dune runtest -p ${pname}
runHook postCheck
'';
installPhase = ''
runHook preInstall
${opaline}/bin/opaline -prefix $out -libdir $OCAMLFIND_DESTDIR
runHook postInstall
'';
meta.platform = ocaml.meta.platform;
} // args // {
name = "ocaml${ocaml.version}-${pname}-${version}";
buildInputs = [ ocaml dune findlib ] ++ buildInputs;
})