<commit_before>with import <nix/config.nix>;

let

  builder = builtins.toFile "unpack-channel.sh"
    ''
      mkdir $out
      cd $out
      xzpat="\.xz\$"
      gzpat="\.gz\$"
      if [[ "$src" =~ $xzpat ]]; then
        ${xz} -d < $src | ${tar} xf - ${tarFlags}
      elif [[ "$src" =~ $gzpat ]]; then
        ${gzip} -d < $src | ${tar} xf - ${tarFlags}
      else
        ${bzip2} -d < $src | ${tar} xf - ${tarFlags}
      fi
      mv * $out/$channelName
      if [ -n "$binaryCacheURL" ]; then
        mkdir $out/binary-caches
        echo -n "$binaryCacheURL" > $out/binary-caches/$channelName
      fi
    '';

in

{ name, channelName, src, binaryCacheURL ? "" }:

derivation {
  system = builtins.currentSystem;
  builder = shell;
  args = [ "-e" builder ];
  inherit name channelName src binaryCacheURL;

  PATH = "${nixBinDir}:${coreutils}";

  # No point in doing this remotely.
  preferLocalBuild = true;

  inherit chrootDeps;
}<commit_msg>unpack-channel.nix: fix 'mv' corner case<commit_after>with import <nix/config.nix>;

let

  builder = builtins.toFile "unpack-channel.sh"
    ''
      mkdir $out
      cd $out
      xzpat="\.xz\$"
      gzpat="\.gz\$"
      if [[ "$src" =~ $xzpat ]]; then
        ${xz} -d < $src | ${tar} xf - ${tarFlags}
      elif [[ "$src" =~ $gzpat ]]; then
        ${gzip} -d < $src | ${tar} xf - ${tarFlags}
      else
        ${bzip2} -d < $src | ${tar} xf - ${tarFlags}
      fi
      if [ * != $channelName ]; then
        mv * $out/$channelName
      fi
      if [ -n "$binaryCacheURL" ]; then
        mkdir $out/binary-caches
        echo -n "$binaryCacheURL" > $out/binary-caches/$channelName
      fi
    '';

in

{ name, channelName, src, binaryCacheURL ? "" }:

derivation {
  system = builtins.currentSystem;
  builder = shell;
  args = [ "-e" builder ];
  inherit name channelName src binaryCacheURL;

  PATH = "${nixBinDir}:${coreutils}";

  # No point in doing this remotely.
  preferLocalBuild = true;

  inherit chrootDeps;
}
{'fraction_non_alphanumeric': 0.17027707808564232, 'fraction_numerical': 0.0010075566750629723, 'mean_word_length': 2.2935323383084576, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 7, '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': '7219253', 'n_tokens_mistral': 738, 'n_tokens_neox': 695, 'n_words': 176}