1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-25 03:17:13 +00:00
nixpkgs/pkgs/build-support/ocaml/dune.nix

37 lines
763 B
Nix
Raw Normal View History

{ stdenv, fetchurl, ocaml, findlib, dune }:
{ 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
${dune.installPhase}
runHook postInstall
'';
meta.platform = ocaml.meta.platform;
} // args // {
name = "ocaml${ocaml.version}-${pname}-${version}";
buildInputs = [ ocaml dune findlib ] ++ buildInputs;
})