<commit_before>{ stdenv, lib, fetchgit, fetchurl, fetchpatch
, libevent, ninja, python, darwin }:

let
  depsGit = {
    "tools/gn" = fetchgit {
      url = "https://chromium.googlesource.com/chromium/src/tools/gn";
      rev = "0fa417a0d2d8484e9a5a636e3301da322f586601";
      sha256 = "0pigcl14yc4aak6q1ghfjxdz2ah4fg4m2r5y3asw2rz6mpr5y9z0";
    };
    "base" = fetchgit {
      url = "https://chromium.googlesource.com/chromium/src/base";
      rev = "ab1d7c3b92ce9c9bc756bdefb8338360d1a33a1e";
      sha256 = "15wis6qg9ka62k6v1vamg0bp3v5vkpapg485jsn4bbfcaqp6di0f";
    };
    "build" = fetchgit {
      url = "https://chromium.googlesource.com/chromium/src/build";
      rev = "8d44c08a4c9997695db8098198bdd5026bc7a6f9";
      sha256 = "19sajgf55xfmvnwvy2ss7g6pyljp751cfsws30w415m6m00lmpxl";
    };
    "config" = fetchgit {
      url = "https://chromium.googlesource.com/chromium/src/build/config";
      rev = "14116c0cdcb9e28995ca8bb384a12e5c9dbd1dbb";
      sha256 = "04nif0lm4wcy05b7xhal023874s4r0iq067q57cgwdm72i2gml40";
    };
    "testing/gtest" = fetchgit {
      url = "https://chromium.googlesource.com/chromium/testing/gtest";
      rev = "585ec31ea716f08233a815e680fc0d4699843938";
      sha256 = "0csn1cza66851nmxxiw42smsm3422mx67vcyykwn0a71lcjng6rc";
    };
    "third_party/apple_apsl" = fetchurl {
      url = "https://chromium.googlesource.com/chromium/src/third_party/+archive/8e6ccb8c74db6dfa15dd21401ace3ac96c054cf7/apple_apsl.tar.gz";
      sha256 = "0sc7b7zdw7f9piyyijl7xq3v1fzflqlck1apwm8kvgdhkyz3l63k";
    };
  };

in stdenv.mkDerivation {
  name = "gn";
  version = "20180423";
  sourceRoot = ".";

  unpackPhase = ''
    ${lib.concatStringsSep "\n" (
      lib.mapAttrsToList (n: v: ''
        mkdir -p $sourceRoot/${n}
        if [ -d ${v} ]; then
          cp -r ${v}/* $sourceRoot/${n}
        else
          mkdir -p $sourceRoot/${n}
          pushd $sourceRoot/${n}
          unpackFile ${v}
          popd
        fi
      '') depsGit)}

    chmod u+w -R $sourceRoot
  '';<commit_msg>gn: Switch to fetchzip for apple_apsl directory<commit_after>{ stdenv, lib, fetchgit, fetchzip, fetchpatch
, libevent, ninja, python, darwin }:

let
  depsGit = {
    "tools/gn" = fetchgit {
      url = "https://chromium.googlesource.com/chromium/src/tools/gn";
      rev = "0fa417a0d2d8484e9a5a636e3301da322f586601";
      sha256 = "0pigcl14yc4aak6q1ghfjxdz2ah4fg4m2r5y3asw2rz6mpr5y9z0";
    };
    "base" = fetchgit {
      url = "https://chromium.googlesource.com/chromium/src/base";
      rev = "ab1d7c3b92ce9c9bc756bdefb8338360d1a33a1e";
      sha256 = "15wis6qg9ka62k6v1vamg0bp3v5vkpapg485jsn4bbfcaqp6di0f";
    };
    "build" = fetchgit {
      url = "https://chromium.googlesource.com/chromium/src/build";
      rev = "8d44c08a4c9997695db8098198bdd5026bc7a6f9";
      sha256 = "19sajgf55xfmvnwvy2ss7g6pyljp751cfsws30w415m6m00lmpxl";
    };
    "config" = fetchgit {
      url = "https://chromium.googlesource.com/chromium/src/build/config";
      rev = "14116c0cdcb9e28995ca8bb384a12e5c9dbd1dbb";
      sha256 = "04nif0lm4wcy05b7xhal023874s4r0iq067q57cgwdm72i2gml40";
    };
    "testing/gtest" = fetchgit {
      url = "https://chromium.googlesource.com/chromium/testing/gtest";
      rev = "585ec31ea716f08233a815e680fc0d4699843938";
      sha256 = "0csn1cza66851nmxxiw42smsm3422mx67vcyykwn0a71lcjng6rc";
    };
    "third_party/apple_apsl" = fetchzip {
      url = "https://chromium.googlesource.com/chromium/src/third_party/+archive/8e6ccb8c74db6dfa15dd21401ace3ac96c054cf7/apple_apsl.tar.gz";
      sha256 = "1vgcg741lwz84kdy0qc5wn9dxx3j9zh6a9d185fpygdsipwikqv8";
      stripRoot = false;
    };
  };

in stdenv.mkDerivation {
  name = "gn";
  version = "20180423";
  sourceRoot = ".";

  unpackPhase = ''
    ${lib.concatStringsSep "\n" (
      lib.mapAttrsToList (n: v: ''
        mkdir -p $sourceRoot/${n}
        if [ -d ${v} ]; then
          cp -r ${v}/* $sourceRoot/${n}
        else
          mkdir -p $sourceRoot/${n}
          pushd $sourceRoot/${n}
          unpackFile ${v}
          popd
        fi
      '') depsGit)}

    chmod u+w -R $sourceRoot
  '';
{'fraction_non_alphanumeric': 0.12801755669348938, 'fraction_numerical': 0.138502804194099, 'mean_word_length': 3.151821862348178, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 12, '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': '3627145', 'n_tokens_mistral': 2080, 'n_tokens_neox': 1801, 'n_words': 202}