<commit_before>{ 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;

})<commit_msg>buildDunePackage: inline dune.installPhase for easier overriding<commit_after>{ 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;

})
{'fraction_non_alphanumeric': 0.1380952380952381, 'fraction_numerical': 0.0, 'mean_word_length': 3.5309973045822103, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3931769', 'n_tokens_mistral': 596, 'n_tokens_neox': 585, 'n_words': 132}