<commit_before>{ stdenv, rust, rustPlatform, buildPackages }:

{ shortTarget, originalCargoToml, target, RUSTFLAGS }:

let rustSrc = stdenv.mkDerivation {
    name = "rust-src";
    src = rustPlatform.rust.rustc.src;
    preferLocalBuild = true;
    phases = [ "unpackPhase" "installPhase" ];
    installPhase = "cp -r src $out";
  };
  cargoSrc = stdenv.mkDerivation {
      name = "cargo-src";
      preferLocalBuild = true;
      phases = [ "installPhase" ];
      installPhase = ''
        RUSTC_SRC=${rustSrc} ORIG_CARGO=${originalCargoToml} \
          ${buildPackages.python3.withPackages (ps: with ps; [ toml ])}/bin/python3 ${./cargo.py}
        mkdir -p $out
        cp Cargo.toml $out/Cargo.toml
        cp ${./Cargo.lock} $out/Cargo.lock
      '';
  };
in rustPlatform.buildRustPackage {
  inherit target RUSTFLAGS;

  name = "custom-sysroot";
  src =  cargoSrc;

  RUSTC_BOOTSTRAP = 1;
  __internal_dontAddSysroot = true;
  cargoSha256 = "1snkfsx3jb1p5izwlfwkgp8hxhgpa35nmx939sp5730vf9whqqwg";

  installPhase = ''
    export LIBS_DIR=$out/lib/rustlib/${shortTarget}/lib
    mkdir -p $LIBS_DIR<commit_msg>fix compile error<commit_after>{ stdenv, rust, rustPlatform, buildPackages }:

{ shortTarget, originalCargoToml, target, RUSTFLAGS }:

let rustSrc = stdenv.mkDerivation {
    name = "rust-src";
    src = rustPlatform.rust.rustc.src;
    preferLocalBuild = true;
    phases = [ "unpackPhase" "installPhase" ];
    installPhase = "cp -r src $out";
  };
  cargoSrc = stdenv.mkDerivation {
      name = "cargo-src";
      preferLocalBuild = true;
      phases = [ "installPhase" ];
      installPhase = ''
        RUSTC_SRC=${rustSrc} ORIG_CARGO=${originalCargoToml} \
          ${buildPackages.python3.withPackages (ps: with ps; [ toml ])}/bin/python3 ${./cargo.py}
        mkdir -p $out
        cp Cargo.toml $out/Cargo.toml
        cp ${./Cargo.lock} $out/Cargo.lock
      '';
  };
in rustPlatform.buildRustPackage {
  inherit target RUSTFLAGS;

  name = "custom-sysroot";
  src =  cargoSrc;

  RUSTC_BOOTSTRAP = 1;
  __internal_dontAddSysroot = true;
  cargoSha256 = "1l5z44dw5h7lbwmpjqax2g40cf4h27yai3wlj0p5di5v1xf25rng";

  doCheck = false;

  installPhase = ''
    export LIBS_DIR=$out/lib/rustlib/${shortTarget}/lib
    mkdir -p $LIBS_DIR
{'fraction_non_alphanumeric': 0.12920353982300886, 'fraction_numerical': 0.020353982300884955, 'mean_word_length': 3.1948051948051948, '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': '2639887', 'n_tokens_mistral': 869, 'n_tokens_neox': 849, 'n_words': 151}