<commit_before>{ stdenv, fetchgit, autoreconfHook, which }:

stdenv.mkDerivation rec {
  name = "torsocks-${version}";
  version = "2.2.0";

  src = fetchgit {
    url    = meta.repositories.git;
    rev    = "refs/tags/v${version}";
    sha256 = "1xwkmfaxhhnbmvp37agnby1n53hznwhvx0dg1hj35467qfx985zc";
  };

  nativeBuildInputs = [ autoreconfHook ];

  patchPhase = ''
    substituteInPlace src/bin/torsocks.in \
      --replace which ${which}/bin/which
  '';

  meta = {
    description      = "Wrapper to safely torify applications";
    homepage         = http://code.google.com/p/torsocks/;
    repositories.git = https://git.torproject.org/torsocks.git;
    license          = stdenv.lib.licenses.gpl2;
    platforms        = stdenv.lib.platforms.unix;
    maintainers      = with stdenv.lib.maintainers; [ phreedom thoughtpolice ];
  };
}<commit_msg>torsocks: redo patching, ensure getcap is available<commit_after>{ stdenv, fetchgit, autoreconfHook, libcap }:

stdenv.mkDerivation rec {
  name = "torsocks-${version}";
  version = "2.2.0";

  src = fetchgit {
    url    = meta.repositories.git;
    rev    = "refs/tags/v${version}";
    sha256 = "1xwkmfaxhhnbmvp37agnby1n53hznwhvx0dg1hj35467qfx985zc";
  };

  nativeBuildInputs = [ autoreconfHook ];

  postPatch = ''
    # Patch torify_app()
    sed -i \
      -e 's,\(local app_path\)=`which $1`,\1=`type -P $1`,' \
      -e 's,\(local getcap\)=.*,\1=${libcap}/bin/getcap,' \
      src/bin/torsocks.in
  '';

  meta = {
    description      = "Wrapper to safely torify applications";
    homepage         = http://code.google.com/p/torsocks/;
    repositories.git = https://git.torproject.org/torsocks.git;
    license          = stdenv.lib.licenses.gpl2;
    platforms        = stdenv.lib.platforms.unix;
    maintainers      = with stdenv.lib.maintainers; [ phreedom thoughtpolice ];
  };
}
{'fraction_non_alphanumeric': 0.14409066378845117, 'fraction_numerical': 0.026983270372369132, 'mean_word_length': 2.783673469387755, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '6421800', 'n_tokens_mistral': 722, 'n_tokens_neox': 678, 'n_words': 109}