<commit_before>{ stdenv, fetchurl, makeWrapper }:

let
  version = "3.5.1";
  arch = if stdenv.is64bit then "amd64" else "x86";
  libDir = if stdenv.is64bit then "lib64" else "lib";
in

stdenv.mkDerivation {
  name = "teamspeak-server-${version}";

  src = fetchurl {
    urls = [
      "http://dl.4players.de/ts/releases/${version}/teamspeak3-server_linux_${arch}-${version}.tar.bz2"
      "http://teamspeak.gameserver.gamed.de/ts3/releases/${version}/teamspeak3-server_linux_${arch}-${version}.tar.bz2"
    ];
    sha256 = if stdenv.is64bit
      then "0ygb867ff2fvi9n9hgs4hldpg4y012w4i1d9cx4f5mpli1xim6da"
      else "0g1cixsldpdbfzg2vain7h3hr5j3xjdngjw66r0aqnzbx743gjzj";
  };

  buildInputs = [ makeWrapper ];

  buildPhase =
    ''
      echo "patching ts3server"
      patchelf \
        --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
        --set-rpath $(cat $NIX_CC/nix-support/orig-cc)/${libDir} \
        --force-rpath \
        ts3server
      cp tsdns/tsdnsserver tsdnsserver
      patchelf \
        --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
        --set-rpath $(cat $NIX_CC/nix-support/orig-cc)/${libDir} \
        --force-rpath \
        tsdnsserver
    '';

  installPhase =
    ''
      # Delete unecessary libraries - these are provided by nixos.<commit_msg>teamspeak_server: 3.5.1 -> 3.6.1 (#56821)<commit_after>{ stdenv, fetchurl, makeWrapper }:

let
  version = "3.6.1";
  arch = if stdenv.is64bit then "amd64" else "x86";
  libDir = if stdenv.is64bit then "lib64" else "lib";
in

stdenv.mkDerivation {
  name = "teamspeak-server-${version}";

  src = fetchurl {
    urls = [
      "http://dl.4players.de/ts/releases/${version}/teamspeak3-server_linux_${arch}-${version}.tar.bz2"
      "http://teamspeak.gameserver.gamed.de/ts3/releases/${version}/teamspeak3-server_linux_${arch}-${version}.tar.bz2"
    ];
    sha256 = if stdenv.is64bit
      then "0wgnb7fdy393anridymm1frlgr86j0awxnzvd498ar5fch06ij87"
      else "0x6p1z4qvgy464n6gnkaqrm7dns1ysyadm68sr260d39a7028q1c";
  };

  buildInputs = [ makeWrapper ];

  buildPhase =
    ''
      echo "patching ts3server"
      patchelf \
        --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
        --set-rpath $(cat $NIX_CC/nix-support/orig-cc)/${libDir} \
        --force-rpath \
        ts3server
      cp tsdns/tsdnsserver tsdnsserver
      patchelf \
        --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
        --set-rpath $(cat $NIX_CC/nix-support/orig-cc)/${libDir} \
        --force-rpath \
        tsdnsserver
    '';

  installPhase =
    ''
      # Delete unecessary libraries - these are provided by nixos.
{'fraction_non_alphanumeric': 0.1472809667673716, 'fraction_numerical': 0.05060422960725076, 'mean_word_length': 2.762784090909091, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '4627801', 'n_tokens_mistral': 1135, 'n_tokens_neox': 1052, 'n_words': 148}