<commit_before>{ lib, stdenv, fetchurl, ocaml, findlib
, lambdaTerm, cppo, makeWrapper, buildDunePackage
}:

if !lib.versionAtLeast ocaml.version "4.03"
then throw "utop is not available for OCaml ${ocaml.version}"
else

buildDunePackage rec {
  pname = "utop";
  version = "2.7.0";

  useDune2 = true;

  src = fetchurl {
    url = "https://github.com/ocaml-community/utop/releases/download/${version}/utop-${version}.tbz";
    sha256 = "sha256-4GisU98mfDzA8vabvCBEBPA2LMTmRyofxUfjJqY8P90=";
  };

  nativeBuildInputs = [ makeWrapper ];
  buildInputs = [ cppo ];

  propagatedBuildInputs = [ lambdaTerm ];

  postFixup =
   let
     path = "etc/utop/env";

     # derivation of just runtime deps so env vars created by
     # setup-hooks can be saved for use at runtime
     runtime = stdenv.mkDerivation {
       pname = "utop-runtime-env";
       inherit version;

       buildInputs = [ findlib ] ++ propagatedBuildInputs;

       phases = [ "installPhase" ];

       installPhase = ''
         mkdir -p "$out"/${path}
         for e in OCAMLPATH CAML_LD_LIBRARY_PATH; do
           [[ -v "$e" ]] || continue<commit_msg>ocamlPackages.utop: 2.7.0 → 2.8.0<commit_after>{ lib, stdenv, fetchurl, ocaml, findlib
, lambdaTerm, cppo, makeWrapper, buildDunePackage
}:

if !lib.versionAtLeast ocaml.version "4.03"
then throw "utop is not available for OCaml ${ocaml.version}"
else

buildDunePackage rec {
  pname = "utop";
  version = "2.8.0";

  useDune2 = true;

  src = fetchurl {
    url = "https://github.com/ocaml-community/utop/releases/download/${version}/utop-${version}.tbz";
    sha256 = "<KEY>";
  };

  nativeBuildInputs = [ makeWrapper ];
  buildInputs = [ cppo ];

  propagatedBuildInputs = [ lambdaTerm ];

  postFixup =
   let
     path = "etc/utop/env";

     # derivation of just runtime deps so env vars created by
     # setup-hooks can be saved for use at runtime
     runtime = stdenv.mkDerivation {
       pname = "utop-runtime-env";
       inherit version;

       buildInputs = [ findlib ] ++ propagatedBuildInputs;

       phases = [ "installPhase" ];

       installPhase = ''
         mkdir -p "$out"/${path}
         for e in OCAMLPATH CAML_LD_LIBRARY_PATH; do
           [[ -v "$e" ]] || continue
{'fraction_non_alphanumeric': 0.12736273627362737, 'fraction_numerical': 0.01665166516651665, 'mean_word_length': 2.913732394366197, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '124877', 'n_tokens_mistral': 806, 'n_tokens_neox': 772, 'n_words': 182}