<commit_before>{ stdenv, fetchurl, libarchive, python3, file }:

stdenv.mkDerivation rec {
  pname = "remarkable-toolchain";
  version = "1.8-23.9.2019";

  src = fetchurl {
    url = "https://remarkable.engineering/oecore-x86_64-cortexa9hf-neon-toolchain-zero-gravitas-${version}.sh";
    sha256 = "6299955721bcd9bef92a87ad3cfe4d31df8e2da95b0c4b2cdded4431aa6748b0";
  };

  nativeBuildInputs = [
    libarchive
    python3
    file
  ];

  unpackCmd = "mkdir src; install $curSrc src/install-toolchain.sh";

  dontBuild = true;

  installPhase = ''
    patchShebangs install-toolchain.sh
    sed -i -e '3,9d' install-toolchain.sh # breaks PATH
    sed -i 's|PYTHON=.*$|PYTHON=${python3}/bin/python|' install-toolchain.sh
    ./install-toolchain.sh -D -y -d $out
  '';

  meta = with stdenv.lib; {
    description = "A toolchain for cross-compiling to reMarkable tablets";
    homepage = "https://remarkable.engineering/";
    license = licenses.gpl2;
    maintainers = [ maintainers.nickhu ];
    platforms = platforms.x86_64;
  };
}<commit_msg>remarkable-toolchain: use which instead of patching with sed<commit_after>{ stdenv, fetchurl, libarchive, python, file, which }:

stdenv.mkDerivation rec {
  pname = "remarkable-toolchain";
  version = "1.8-23.9.2019";

  src = fetchurl {
    url = "https://remarkable.engineering/oecore-x86_64-cortexa9hf-neon-toolchain-zero-gravitas-${version}.sh";
    sha256 = "1rk1r80m5d18sw6hrybj6f78s8pna0wrsa40ax6j8jzfwahgzmfb";
    executable = true;
  };

  nativeBuildInputs = [
    libarchive
    python
    file
    which
  ];

  dontUnpack = true;
  dontBuild = true;

  installPhase = ''
    mkdir -p $out
    ENVCLEANED=1 $src -y -d $out
  '';

  meta = with stdenv.lib; {
    description = "A toolchain for cross-compiling to reMarkable tablets";
    homepage = "https://remarkable.engineering/";
    license = licenses.gpl2;
    maintainers = with maintainers; [ <NAME> ];
    platforms = [ "x86_64-linux" ];
  };
}
{'fraction_non_alphanumeric': 0.13200815494393475, 'fraction_numerical': 0.05198776758409786, 'mean_word_length': 3.401345291479821, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 4, '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': '2562833', 'n_tokens_mistral': 792, 'n_tokens_neox': 738, 'n_words': 135}