<commit_before>{ stdenv, buildGoPackage, fetchurl, cmake, xz, which, autoconf, ncurses6, libedit }:

buildGoPackage rec {
  name = "cockroach-${version}";
  version = "2.0.0";

  goPackagePath = "github.com/cockroachdb/cockroach";

  src = fetchurl {
    url = "https://binaries.cockroachdb.com/cockroach-v${version}.src.tgz";
    sha256 = "0x8hf5qwvgb2w6dcnvy20v77nf19f0l1pb40jf31rm72xhk3bwvy";
  };

  buildInputs = [ (if stdenv.isDarwin then libedit else ncurses6) ];
  nativeBuildInputs = [ cmake xz which autoconf ];

  buildPhase = ''
    runHook preBuild
    cd $NIX_BUILD_TOP/go/src/${goPackagePath}
    patchShebangs .
    make buildoss
    cd src/${goPackagePath}
    for asset in man autocomplete; do
      ./cockroach gen $asset
    done
    runHook postBuild
  '';

  installPhase = ''
    runHook preInstall
    install -D cockroach $bin/bin/cockroach
    install -D cockroach.bash $bin/share/bash-completion/completions/cockroach.bash
    cp -r man $bin/share/man
    runHook postInstall
  '';

  meta = with stdenv.lib; {
    homepage = https://www.cockroachlabs.com;
    description = "A scalable, survivable, strongly-consistent SQL database";
    license = licenses.asl20;
    platforms = [ "x86_64-linux" "x86_64-darwin" ];
    maintainers = [ maintainers.rushmorem ];
  };
}<commit_msg>cockroachdb: 2.0.0 -> 2.1.1, aarch64 support<commit_after>{ stdenv, buildGoPackage, fetchurl
, cmake, xz, which, autoconf
, ncurses6, libedit, libunwind
}:

let
  darwinDeps = [ libunwind libedit ];
  linuxDeps  = [ ncurses6 ];

  buildInputs = if stdenv.isDarwin then darwinDeps else linuxDeps;
  nativeBuildInputs = [ cmake xz which autoconf ];

in
buildGoPackage rec {
  name = "cockroach-${version}";
  version = "2.1.1";

  goPackagePath = "github.com/cockroachdb/cockroach";

  src = fetchurl {
    url = "https://binaries.cockroachdb.com/cockroach-v${version}.src.tgz";
    sha256 = "1z34zlwznh4lgbc1ryn577w7mmycyjbmz28k1hhhb6ricmk1x847";
  };

  inherit nativeBuildInputs buildInputs;

  buildPhase = ''
    runHook preBuild
    cd $NIX_BUILD_TOP/go/src/${goPackagePath}
    patchShebangs .
    make buildoss
    cd src/${goPackagePath}
    for asset in man autocomplete; do
      ./cockroachoss gen $asset
    done
    runHook postBuild
  '';

  installPhase = ''
    runHook preInstall

    install -D cockroachoss $bin/bin/cockroach
    install -D cockroach.bash $bin/share/bash-completion/completions/cockroach.bash

    mkdir -p $man/share/man
    cp -r man $man/share/man

    runHook postInstall
  '';

  # Unfortunately we have to keep an empty reference to $out, because it seems
  # buildGoPackages only nukes references to the go compiler under $bin, effectively
  # making all binary output under $bin mandatory. Ideally, we would just use
  # $out and $man and remove $bin since there's no point in an empty path. :(
  outputs = [ "bin" "man" "out" ];

  meta = with stdenv.lib; {
    homepage    = https://www.cockroachlabs.com;
    description = "A scalable, survivable, strongly-consistent SQL database";
    license     = licenses.asl20;
    platforms   = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" ];
    maintainers = with maintainers; [ rushmorem thoughtpolice ];
  };
}
{'fraction_non_alphanumeric': 0.11180317658050451, 'fraction_numerical': 0.025848645281843663, 'mean_word_length': 3.4242424242424243, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, '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': '7576214', 'n_tokens_mistral': 1202, 'n_tokens_neox': 1138, 'n_words': 264}