about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/networking/p2p
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/applications/networking/p2p')
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/deluge/default.nix86
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/dht/default.nix24
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/eiskaltdcpp/default.nix52
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/fragments/default.nix78
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/fragments/dependency-resolution.patch25
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/freenet/default.nix80
-rwxr-xr-xnixpkgs/pkgs/applications/networking/p2p/freenet/freenetWrapper18
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/frostwire/default.nix94
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/frostwire/frostwire-bin.nix29
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/gnunet/default.nix74
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/gnunet/gtk.nix47
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/ktorrent/default.nix32
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/libutp/default.nix24
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/magnetico/default.nix32
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/mldonkey/default.nix31
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/ncdc/default.nix22
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/opentracker/default.nix38
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/qbittorrent/default.nix57
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/retroshare/default.nix53
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/retroshare/no-submodules.patch62
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/soulseekqt/default.nix59
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/stig/default.nix68
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/synapse-bt/default.nix28
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/tixati/default.nix30
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/torrential/default.nix81
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/transgui/default.nix77
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/transmission-remote-gtk/default.nix42
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/transmission/default.nix142
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/tremc/default.nix59
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/tribler/default.nix90
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/twister/default.nix67
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/vuze/default.nix30
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/xd/default.nix29
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/zeronet/default.nix41
34 files changed, 1801 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/applications/networking/p2p/deluge/default.nix b/nixpkgs/pkgs/applications/networking/p2p/deluge/default.nix
new file mode 100644
index 000000000000..2bd3cd739e66
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/deluge/default.nix
@@ -0,0 +1,86 @@
+{ lib
+, fetchurl
+, fetchpatch
+, intltool
+, libtorrent-rasterbar
+, pythonPackages
+, gtk3
+, glib
+, gobject-introspection
+, librsvg
+, wrapGAppsHook
+}:
+
+pythonPackages.buildPythonPackage rec {
+  pname = "deluge";
+  version = "2.0.3";
+
+  src = fetchurl {
+    url = "http://download.deluge-torrent.org/source/2.0/${pname}-${version}.tar.xz";
+    sha256 = "14d8kn2pvr1qv8mwqrxmj85jycr73vwfqz12hzag0ararbkfhyky";
+  };
+
+  patches = [
+    (fetchpatch {
+      url = "https://github.com/deluge-torrent/deluge/commit/d6c96d629183e8bab2167ef56457f994017e7c85.patch";
+      sha256 = "sha256-slGMt2bgp36pjDztJUXFeZNbzdJsus0s9ARRD6IpNUw=";
+      name = "fix_ngettext_warning.patch";
+    })
+
+    (fetchpatch {
+      url = "https://github.com/deluge-torrent/deluge/commit/351664ec071daa04161577c6a1c949ed0f2c3206.patch";
+      sha256 = "sha256-ry1LFgMe9lys66xAvATcPqIa3rzBPWVnsf8FL1dXkHo=";
+      name = "fix_logging_on_py38.patch";
+    })
+  ];
+
+  propagatedBuildInputs = with pythonPackages; [
+    twisted
+    Mako
+    chardet
+    pyxdg
+    pyopenssl
+    service-identity
+    libtorrent-rasterbar.dev
+    libtorrent-rasterbar.python
+    setuptools
+    setproctitle
+    pillow
+    rencode
+    six
+    zope_interface
+    dbus-python
+    pygobject3
+    pycairo
+    gtk3
+    gobject-introspection
+    librsvg
+  ];
+
+  nativeBuildInputs = [ intltool wrapGAppsHook glib ];
+
+  checkInputs = with pythonPackages; [
+    pytestCheckHook
+    pytest-twisted
+    pytest-cov
+    mock
+    mccabe
+    pylint
+  ];
+
+  doCheck = false; # until pytest-twisted is packaged
+
+  postInstall = ''
+    mkdir -p $out/share
+    cp -R deluge/ui/data/{icons,pixmaps} $out/share/
+    install -Dm444 -t $out/share/applications deluge/ui/data/share/applications/deluge.desktop
+  '';
+
+  meta = with lib; {
+    homepage = "https://deluge-torrent.org";
+    description = "Torrent client";
+    license = licenses.gpl3Plus;
+    maintainers = with maintainers; [ domenkozar ebzzry ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/applications/networking/p2p/dht/default.nix b/nixpkgs/pkgs/applications/networking/p2p/dht/default.nix
new file mode 100644
index 000000000000..0088e517914f
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/dht/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, lib, fetchFromGitHub, cmake }:
+
+stdenv.mkDerivation rec {
+  pname = "dht";
+  version = "0.25";
+
+  src = fetchFromGitHub {
+    # Use transmission fork from post-0.25-transmission branch
+    owner = "transmission";
+    repo = pname;
+    rev = "25e12bb39eea3d433602de6390796fec8a8f3620";
+    sha256 = "fksi8WBQPydgSlISaZMMnxzt4xN7/Hh7aN6QQ+g/L7s=";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  meta = with lib; {
+    description = "BitTorrent DHT library";
+    homepage = "https://github.com/transmission/dht";
+    license = licenses.mit;
+    maintainers = with maintainers; [ angustrau ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/applications/networking/p2p/eiskaltdcpp/default.nix b/nixpkgs/pkgs/applications/networking/p2p/eiskaltdcpp/default.nix
new file mode 100644
index 000000000000..f86eefe668f9
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/eiskaltdcpp/default.nix
@@ -0,0 +1,52 @@
+{ lib, stdenv, fetchFromGitHub, cmake, pkg-config, bzip2, libX11
+, mkDerivation, qtbase, qttools, qtmultimedia, qtscript
+, libiconv, pcre-cpp, libidn, lua5, miniupnpc, aspell, gettext, perl }:
+
+mkDerivation rec {
+  pname = "eiskaltdcpp";
+  version = "2.4.2";
+
+  src = fetchFromGitHub {
+    owner = "eiskaltdcpp";
+    repo = "eiskaltdcpp";
+    rev = "v${version}";
+    sha256 = "sha256-JmAopXFS6MkxW0wDQ1bC/ibRmWgOpzU0971hcqAehLU=";
+  };
+
+  nativeBuildInputs = [ cmake pkg-config ];
+  buildInputs = [ qtbase qttools qtmultimedia qtscript bzip2 libX11 pcre-cpp libidn lua5 miniupnpc aspell gettext
+    (perl.withPackages (p: with p; [
+      GetoptLong
+      TermShellUI
+    ])) ]
+    ++ lib.optional stdenv.isDarwin libiconv;
+
+  cmakeFlags = [
+    "-DDBUS_NOTIFY=ON"
+    "-DFREE_SPACE_BAR_C=ON"
+    "-DLUA_SCRIPT=ON"
+    "-DPERL_REGEX=ON"
+    "-DUSE_ASPELL=ON"
+    "-DUSE_CLI_JSONRPC=ON"
+    "-DUSE_MINIUPNP=ON"
+    "-DUSE_JS=ON"
+    "-DWITH_LUASCRIPTS=ON"
+    "-DWITH_SOUNDS=ON"
+  ];
+
+  postInstall = ''
+    ln -s $out/bin/$pname-qt $out/bin/$pname
+  '';
+
+  preFixup = ''
+    substituteInPlace $out/bin/eiskaltdcpp-cli-jsonrpc \
+      --replace "/usr/local" "$out"
+  '';
+
+  meta = with lib; {
+    description = "A cross-platform program that uses the Direct Connect and ADC protocols";
+    homepage = "https://github.com/eiskaltdcpp/eiskaltdcpp";
+    license = licenses.gpl3Plus;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/applications/networking/p2p/fragments/default.nix b/nixpkgs/pkgs/applications/networking/p2p/fragments/default.nix
new file mode 100644
index 000000000000..721f0ca259f0
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/fragments/default.nix
@@ -0,0 +1,78 @@
+{ lib
+, stdenv
+, fetchFromGitLab
+, meson
+, vala
+, ninja
+, pkg-config
+, wrapGAppsHook
+, desktop-file-utils
+, appstream-glib
+, python3
+, glib
+, gtk3
+, libhandy
+, libtransmission
+, libb64
+, libutp
+, miniupnpc
+, dht
+, libnatpmp
+, libevent
+, curl
+, openssl
+, zlib
+}:
+
+stdenv.mkDerivation rec {
+  pname = "fragments";
+  version = "1.5";
+
+  src = fetchFromGitLab {
+    domain = "gitlab.gnome.org";
+    owner = "World";
+    repo = "Fragments";
+    rev = version;
+    sha256 = "0x1kafhlgyi65l4w67c24r8mpvasg3q3c4wlgnjc9sxvp6ki7xbn";
+  };
+
+  patches = [
+    # Fix dependency resolution
+    ./dependency-resolution.patch
+  ];
+
+  nativeBuildInputs = [
+    meson
+    vala
+    ninja
+    pkg-config
+    wrapGAppsHook
+    desktop-file-utils
+    appstream-glib
+    python3
+  ];
+
+  buildInputs = [
+    glib
+    gtk3
+    libhandy
+    libtransmission
+    libb64
+    libutp
+    miniupnpc
+    dht
+    libnatpmp
+    libevent
+    curl
+    openssl
+    zlib
+  ];
+
+  meta = with lib; {
+    homepage = "https://gitlab.gnome.org/World/Fragments";
+    description = "A GTK3 BitTorrent Client";
+    maintainers = with maintainers; [ angustrau ];
+    license = licenses.gpl3Plus;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/applications/networking/p2p/fragments/dependency-resolution.patch b/nixpkgs/pkgs/applications/networking/p2p/fragments/dependency-resolution.patch
new file mode 100644
index 000000000000..0446bc1390c7
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/fragments/dependency-resolution.patch
@@ -0,0 +1,25 @@
+diff --git a/meson.build b/meson.build
+index 5030d0c..6de7a20 100644
+--- a/meson.build
++++ b/meson.build
+@@ -32,10 +32,11 @@ transmission_dep = declare_dependency(
+ 				meson.get_compiler('c').find_library('dht'),
+ 				meson.get_compiler('c').find_library('natpmp'),
+ 				meson.get_compiler('c').find_library('event'),
+-				meson.get_compiler('c').find_library('libcurl'),
+-				meson.get_compiler('c').find_library('libcrypto'),
++				meson.get_compiler('c').find_library('curl'),
++				meson.get_compiler('c').find_library('crypto'),
++				meson.get_compiler('c').find_library('ssl'),
+ 				meson.get_compiler('c').find_library('libpthread'),
+-				meson.get_compiler('c').find_library('libz'),
++				meson.get_compiler('c').find_library('z'),
+ 				transmission_vapi,
+ 				transmission_lib
+ 			])
+@@ -45,4 +46,4 @@ subdir('data')
+ subdir('po')
+ subdir('src')
+ 
+-meson.add_install_script('build-aux/postinstall.py')
++meson.add_install_script('python3', '../build-aux/postinstall.py')
diff --git a/nixpkgs/pkgs/applications/networking/p2p/freenet/default.nix b/nixpkgs/pkgs/applications/networking/p2p/freenet/default.nix
new file mode 100644
index 000000000000..ad791f46d739
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/freenet/default.nix
@@ -0,0 +1,80 @@
+{ lib, stdenv, fetchurl, fetchFromGitHub, ant, jdk, bash, coreutils, substituteAll }:
+
+let
+  freenet_ext = fetchurl {
+    url = "https://downloads.freenetproject.org/latest/freenet-ext.jar";
+    sha256 = "17ypljdvazgx2z6hhswny1lxfrknysz3x6igx8vl3xgdpvbb7wij";
+  };
+
+  bcprov_version = "jdk15on-154";
+  bcprov = fetchurl {
+    url = "https://www.bouncycastle.org/download/bcprov-ext-${bcprov_version}.jar";
+    sha256 = "0abmhg2h44g8c5p7skzqwfxj8xwcjh9vs84mc0hr78k1am0633jk";
+  };
+  seednodes = fetchurl {
+    url = "https://downloads.freenetproject.org/alpha/opennet/seednodes.fref";
+    sha256 = "08awwr8n80b4cdzzb3y8hf2fzkr1f2ly4nlq779d6pvi5jymqdvv";
+  };
+  version = "build01480";
+
+  freenet-jars = stdenv.mkDerivation {
+    pname = "freenet-jars";
+    inherit version;
+
+    src = fetchFromGitHub {
+      owner = "freenet";
+      repo = "fred";
+      rev = version;
+      sha256 = "0wddkfyhsgs7bcq9svicz6l0a35yv82yqzmji3c345hg4hbch3kb";
+    };
+
+    patchPhase = ''
+      cp ${freenet_ext} lib/freenet/freenet-ext.jar
+      cp ${bcprov} lib/bcprov-${bcprov_version}.jar
+
+      sed '/antcall.*-ext/d' -i build.xml
+      sed 's/@unknown@/${version}/g' -i build-clean.xml
+    '';
+
+    buildInputs = [ ant jdk ];
+
+    buildPhase = "ant package-only";
+
+    installPhase = ''
+      mkdir -p $out/share/freenet
+      cp lib/bcprov-${bcprov_version}.jar $out/share/freenet
+      cp lib/freenet/freenet-ext.jar $out/share/freenet
+      cp dist/freenet.jar $out/share/freenet
+    '';
+  };
+
+in stdenv.mkDerivation {
+  name = "freenet-${version}";
+  inherit version;
+
+  src = substituteAll {
+    src = ./freenetWrapper;
+    inherit bash coreutils seednodes bcprov_version;
+    freenet = freenet-jars;
+    jre = jdk.jre;
+  };
+
+  jars = freenet-jars;
+
+  dontUnpack = true;
+
+  installPhase = ''
+    mkdir -p $out/bin
+    cp $src $out/bin/freenet
+    chmod +x $out/bin/freenet
+    ln -s ${freenet-jars}/share $out/share
+  '';
+
+  meta = {
+    description = "Decentralised and censorship-resistant network";
+    homepage = "https://freenetproject.org/";
+    license = lib.licenses.gpl2Plus;
+    maintainers = [ ];
+    platforms = with lib.platforms; linux;
+  };
+}
diff --git a/nixpkgs/pkgs/applications/networking/p2p/freenet/freenetWrapper b/nixpkgs/pkgs/applications/networking/p2p/freenet/freenetWrapper
new file mode 100755
index 000000000000..f3106265801f
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/freenet/freenetWrapper
@@ -0,0 +1,18 @@
+#! @bash@/bin/bash
+
+PATH=@coreutils@/bin:$PATH
+
+export FREENET_HOME="$HOME/.local/share/freenet"
+if [ -n "$XDG_DATA_HOME" ]
+  then export FREENET_HOME="$XDG_DATA_HOME/freenet"
+fi
+
+if [ ! -d $FREENET_HOME ]; then
+  mkdir -p $FREENET_HOME
+fi
+
+cp -u @seednodes@ $FREENET_HOME/seednodes.fref
+chmod u+rw $FREENET_HOME/seednodes.fref
+
+cd $FREENET_HOME
+@jre@/bin/java -cp @freenet@/share/freenet/bcprov-@bcprov_version@.jar:@freenet@/share/freenet/freenet-ext.jar:@freenet@/share/freenet/freenet.jar -Xmx1024M freenet.node.NodeStarter
diff --git a/nixpkgs/pkgs/applications/networking/p2p/frostwire/default.nix b/nixpkgs/pkgs/applications/networking/p2p/frostwire/default.nix
new file mode 100644
index 000000000000..b3b277bf130a
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/frostwire/default.nix
@@ -0,0 +1,94 @@
+{ lib, stdenv, fetchFromGitHub, gradle_6, perl, jre, makeWrapper, makeDesktopItem, mplayer }:
+
+let
+  version = "6.6.7-build-529";
+  name = "frostwire-desktop-${version}";
+
+  src = fetchFromGitHub {
+    owner = "frostwire";
+    repo = "frostwire";
+    rev = name;
+    sha256 = "03wdj2kr8akzx8m1scvg98132zbaxh81qjdsxn2645b3gahjwz0m";
+  };
+
+  desktopItem = makeDesktopItem {
+    name = "frostwire";
+    desktopName = "FrostWire";
+    genericName = "P2P Bittorrent client";
+    exec = "frostwire";
+    icon = "frostwire";
+    comment = "Search and explore all kinds of files on the Bittorrent network";
+    categories = "Network;FileTransfer;P2P;";
+  };
+
+  # fake build to pre-download deps into fixed-output derivation
+  deps = stdenv.mkDerivation {
+    name = "${name}-deps";
+    inherit src;
+    buildInputs = [ gradle_6 perl ];
+    buildPhase = ''
+      export GRADLE_USER_HOME=$(mktemp -d)
+      ( cd desktop
+        gradle --no-daemon build
+      )
+    '';
+    # perl code mavenizes pathes (com.squareup.okio/okio/1.13.0/a9283170b7305c8d92d25aff02a6ab7e45d06cbe/okio-1.13.0.jar -> com/squareup/okio/okio/1.13.0/okio-1.13.0.jar)
+    installPhase = ''
+      find $GRADLE_USER_HOME -type f -regex '.*\.\(jar\|pom\)' \
+        | perl -pe 's#(.*/([^/]+)/([^/]+)/([^/]+)/[0-9a-f]{30,40}/([^/\s]+))$# ($x = $2) =~ tr|\.|/|; "install -Dm444 $1 \$out/$x/$3/$4/$5" #e' \
+        | sh
+    '';
+    outputHashAlgo = "sha256";
+    outputHashMode = "recursive";
+    outputHash = "11zd98g0d0fdgls4lsskkagwfxyh26spfd6c6g9cahl89czvlg3c";
+  };
+
+in stdenv.mkDerivation {
+  inherit name src;
+
+  nativeBuildInputs = [ makeWrapper ];
+  buildInputs = [ gradle_6 ];
+
+  buildPhase = ''
+    export GRADLE_USER_HOME=$(mktemp -d)
+    ( cd desktop
+
+      # disable auto-update (anyway it won't update frostwire installed in nix store)
+      substituteInPlace src/com/frostwire/gui/updates/UpdateManager.java \
+        --replace 'um.checkForUpdates' '// um.checkForUpdates'
+
+      # fix path to mplayer
+      substituteInPlace src/com/frostwire/gui/player/MediaPlayerLinux.java \
+        --replace /usr/bin/mplayer ${mplayer}/bin/mplayer
+
+      substituteInPlace build.gradle \
+        --replace 'mavenCentral()' 'mavenLocal(); maven { url uri("${deps}") }'
+      gradle --offline --no-daemon build
+    )
+  '';
+
+  installPhase = ''
+    mkdir -p $out/lib $out/share/java
+
+    cp desktop/build/libs/frostwire.jar $out/share/java/frostwire.jar
+
+    cp ${ { x86_64-darwin = "desktop/lib/native/*.dylib";
+            x86_64-linux  = "desktop/lib/native/lib{jlibtorrent,SystemUtilities}.so";
+            i686-linux    = "desktop/lib/native/lib{jlibtorrent,SystemUtilities}X86.so";
+          }.${stdenv.hostPlatform.system} or (throw "unsupported system ${stdenv.hostPlatform.system}")
+        } $out/lib
+
+    cp -dpR ${desktopItem}/share $out
+
+    makeWrapper ${jre}/bin/java $out/bin/frostwire \
+      --add-flags "-Djava.library.path=$out/lib -jar $out/share/java/frostwire.jar"
+  '';
+
+  meta = with lib; {
+    homepage = "https://www.frostwire.com/";
+    description = "BitTorrent Client and Cloud File Downloader";
+    license = licenses.gpl2;
+    maintainers = with maintainers; [ gavin ];
+    platforms = [ "x86_64-darwin" "x86_64-linux" "i686-linux" ];
+  };
+}
diff --git a/nixpkgs/pkgs/applications/networking/p2p/frostwire/frostwire-bin.nix b/nixpkgs/pkgs/applications/networking/p2p/frostwire/frostwire-bin.nix
new file mode 100644
index 000000000000..0f7a806ed8f1
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/frostwire/frostwire-bin.nix
@@ -0,0 +1,29 @@
+{ lib, stdenv, fetchurl, jre, makeWrapper }:
+
+stdenv.mkDerivation rec {
+  version = "6.9.4";
+  pname = "frostwire";
+
+  src = fetchurl {
+    url = "https://dl.frostwire.com/frostwire/${version}/frostwire-${version}.amd64.tar.gz";
+    sha256 = "sha256-sWvQDUJGytKA9/UbC7fOk6WhDtTqdhyRmW9GvHFMZh4=";
+  };
+
+  nativeBuildInputs = [ makeWrapper ];
+
+  installPhase = ''
+    mkdir -p $out/share/java
+    mv $(ls */*.jar) $out/share/java
+
+    makeWrapper $out/share/java/frostwire $out/bin/frostwire \
+      --prefix PATH : ${jre}/bin/
+  '';
+
+  meta = with lib; {
+    homepage = "https://www.frostwire.com/";
+    description = "BitTorrent Client and Cloud File Downloader";
+    license = licenses.gpl2;
+    maintainers = with maintainers; [ gavin ];
+    platforms = [ "x86_64-linux"];
+  };
+}
diff --git a/nixpkgs/pkgs/applications/networking/p2p/gnunet/default.nix b/nixpkgs/pkgs/applications/networking/p2p/gnunet/default.nix
new file mode 100644
index 000000000000..2ccf4ff4b860
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/gnunet/default.nix
@@ -0,0 +1,74 @@
+{ lib, stdenv, fetchurl, adns, curl, gettext, gmp, gnutls, libextractor
+, libgcrypt, libgnurl, libidn, libmicrohttpd, libtool, libunistring
+, makeWrapper, ncurses, pkg-config, libxml2, sqlite, zlib
+, libpulseaudio, libopus, libogg, jansson, libsodium
+
+, postgresqlSupport ? false, postgresql }:
+
+stdenv.mkDerivation rec {
+  pname = "gnunet";
+  version = "0.15.3";
+
+  src = fetchurl {
+    url = "mirror://gnu/gnunet/${pname}-${version}.tar.gz";
+    sha256 = "sha256-1iZpqPQeB46qIgznejL08/gB4wmTV66McFSY/nOITsU=";
+  };
+
+  enableParallelBuilding = true;
+
+  nativeBuildInputs = [ pkg-config libtool makeWrapper ];
+  buildInputs = [
+    adns curl gmp gnutls libextractor libgcrypt libgnurl libidn
+    libmicrohttpd libunistring libxml2 ncurses gettext libsodium
+    sqlite zlib libpulseaudio libopus libogg jansson
+  ] ++ lib.optional postgresqlSupport postgresql;
+
+  preConfigure = ''
+    # Brute force: since nix-worker chroots don't provide
+    # /etc/{resolv.conf,hosts}, replace all references to `localhost'
+    # by their IPv4 equivalent.
+    find . \( -name \*.c -or -name \*.conf \) | \
+      xargs sed -ie 's|\<localhost\>|127.0.0.1|g'
+
+    # Make sure the tests don't rely on `/tmp', for the sake of chroot
+    # builds.
+    find . \( -iname \*test\*.c -or -name \*.conf \) | \
+      xargs sed -ie "s|/tmp|$TMPDIR|g"
+
+    sed -ie 's|@LDFLAGS@|@LDFLAGS@ $(Z_LIBS)|g' \
+      src/regex/Makefile.in \
+      src/fs/Makefile.in
+  '';
+
+  # unfortunately, there's still a few failures with impure tests
+  doCheck = false;
+  checkPhase = ''
+    export GNUNET_PREFIX="$out"
+    export PATH="$out/bin:$PATH"
+    make -k check
+  '';
+
+  meta = with lib; {
+    description = "GNU's decentralized anonymous and censorship-resistant P2P framework";
+
+    longDescription = ''
+      GNUnet is a framework for secure peer-to-peer networking that
+      does not use any centralized or otherwise trusted services.  A
+      first service implemented on top of the networking layer
+      allows anonymous censorship-resistant file-sharing.  Anonymity
+      is provided by making messages originating from a peer
+      indistinguishable from messages that the peer is routing.  All
+      peers act as routers and use link-encrypted connections with
+      stable bandwidth utilization to communicate with each other.
+      GNUnet uses a simple, excess-based economic model to allocate
+      resources.  Peers in GNUnet monitor each others behavior with
+      respect to resource usage; peers that contribute to the
+      network are rewarded with better service.
+    '';
+
+    homepage = "https://gnunet.org/";
+    license = licenses.agpl3Plus;
+    maintainers = with maintainers; [ pstn vrthra ];
+    platforms = platforms.gnu ++ platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/applications/networking/p2p/gnunet/gtk.nix b/nixpkgs/pkgs/applications/networking/p2p/gnunet/gtk.nix
new file mode 100644
index 000000000000..3711d5a3c1ed
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/gnunet/gtk.nix
@@ -0,0 +1,47 @@
+{ stdenv, fetchurl
+, glade
+, gnunet
+, gnutls
+, gtk3
+, libextractor
+, libgcrypt
+, libsodium
+, libxml2
+, pkg-config
+, wrapGAppsHook
+}:
+
+stdenv.mkDerivation rec {
+  pname = "gnunet-gtk";
+  version = "0.14.0";
+
+  src = fetchurl {
+    url = "mirror://gnu/gnunet/${pname}-${version}.tar.gz";
+    sha256 = "18rc7mb45y17d5nrlpf2p4ixp7ir67gcgjf4hlj4r95ic5zi54wa";
+  };
+
+  nativeBuildInputs= [
+    pkg-config
+    wrapGAppsHook
+  ];
+
+  buildInputs = [
+    glade
+    gnunet
+    gnutls
+    gtk3
+    libextractor
+    libgcrypt
+    libsodium
+    libxml2
+  ];
+
+  configureFlags = [ "--with-gnunet=${gnunet}" ];
+
+  patchPhase = "patchShebangs pixmaps/icon-theme-installer";
+
+  meta = gnunet.meta // {
+    description = "GNUnet GTK User Interface";
+    homepage = "https://git.gnunet.org/gnunet-gtk.git";
+  };
+}
diff --git a/nixpkgs/pkgs/applications/networking/p2p/ktorrent/default.nix b/nixpkgs/pkgs/applications/networking/p2p/ktorrent/default.nix
new file mode 100644
index 000000000000..94a4642b2de1
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/ktorrent/default.nix
@@ -0,0 +1,32 @@
+{ mkDerivation, lib, fetchurl, fetchpatch, cmake
+, extra-cmake-modules, qtbase, qtscript
+, karchive, kcrash, kdnssd, ki18n, kio, knotifications, knotifyconfig
+, kdoctools, kross, kcmutils, kwindowsystem
+, libktorrent, taglib, libgcrypt, kplotting
+}:
+
+mkDerivation rec {
+  pname = "ktorrent";
+  version = "${libktorrent.mainVersion}";
+
+  src = fetchurl {
+    url    = "mirror://kde/stable/ktorrent/${libktorrent.mainVersion}/${pname}-${version}.tar.xz";
+    sha256 = "0kwd0npxfg4mdh7f3xadd2zjlqalpb1jxk61505qpcgcssijf534";
+  };
+
+  nativeBuildInputs = [ cmake kdoctools extra-cmake-modules ];
+
+  buildInputs = [
+    qtbase qtscript
+    karchive kcrash kdnssd ki18n kio knotifications knotifyconfig kross kcmutils kwindowsystem
+    libktorrent taglib libgcrypt kplotting
+  ];
+
+  meta = with lib; {
+    description = "KDE integrated BtTorrent client";
+    homepage    = "https://www.kde.org/applications/internet/ktorrent/";
+    license = licenses.gpl2;
+    maintainers = with maintainers; [ eelco ];
+    platforms   = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/applications/networking/p2p/libutp/default.nix b/nixpkgs/pkgs/applications/networking/p2p/libutp/default.nix
new file mode 100644
index 000000000000..6fba4faf50c0
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/libutp/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, lib, fetchFromGitHub, cmake }:
+
+stdenv.mkDerivation rec {
+  pname = "libutp";
+  version = "unstable-2017-01-02";
+
+  src = fetchFromGitHub {
+    # Use transmission fork from post-3.3-transmission branch
+    owner = "transmission";
+    repo = pname;
+    rev = "fda9f4b3db97ccb243fcbed2ce280eb4135d705b";
+    sha256 = "CvuZLOBksIl/lS6LaqOIuzNvX3ihlIPjI3Eqwo7YJH0=";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  meta = with lib; {
+    description = "uTorrent Transport Protocol library";
+    homepage = "https://github.com/transmission/libutp";
+    license = licenses.mit;
+    maintainers = with maintainers; [ angustrau ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/applications/networking/p2p/magnetico/default.nix b/nixpkgs/pkgs/applications/networking/p2p/magnetico/default.nix
new file mode 100644
index 000000000000..124e3492c8cd
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/magnetico/default.nix
@@ -0,0 +1,32 @@
+{ lib, fetchFromGitHub, buildGoModule, go-bindata }:
+
+buildGoModule rec {
+  pname = "magnetico";
+  version = "0.12.0";
+
+  src = fetchFromGitHub {
+    owner  = "boramalper";
+    repo   = "magnetico";
+    rev    = "v${version}";
+    sha256 = "1avqnfn4llmc9xmpsjfc9ivki0cfvd8sljfzd9yac94xcj581s83";
+  };
+
+  vendorSha256 = "087kikj6sjhjxqymnj7bpxawfmwckihi6mbmi39w0bn2040aflx5";
+
+  nativeBuildInputs = [ go-bindata ];
+  buildPhase = ''
+    make magneticow magneticod
+  '';
+
+  checkPhase = ''
+    make test
+  '';
+
+  meta = with lib; {
+    description  = "Autonomous (self-hosted) BitTorrent DHT search engine suite";
+    homepage     = "https://github.com/boramalper/magnetico";
+    license      = licenses.agpl3;
+    badPlatforms = platforms.darwin;
+    maintainers  = with maintainers; [ rnhmjoj ];
+  };
+}
diff --git a/nixpkgs/pkgs/applications/networking/p2p/mldonkey/default.nix b/nixpkgs/pkgs/applications/networking/p2p/mldonkey/default.nix
new file mode 100644
index 000000000000..41b8a7d0b6c2
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/mldonkey/default.nix
@@ -0,0 +1,31 @@
+{ lib, stdenv, fetchurl, ocamlPackages, zlib }:
+
+stdenv.mkDerivation rec {
+  pname = "mldonkey";
+  version = "3.1.7-2";
+
+  src = fetchurl {
+    url = "https://ygrek.org/p/release/mldonkey/mldonkey-${version}.tar.bz2";
+    sha256 = "b926e7aa3de4b4525af73c88f1724d576b4add56ef070f025941dd51cb24a794";
+  };
+
+  preConfigure = ''
+    substituteInPlace Makefile --replace '+camlp4' \
+      '${ocamlPackages.camlp4}/lib/ocaml/${ocamlPackages.ocaml.version}/site-lib/camlp4'
+  '';
+
+  buildInputs = (with ocamlPackages; [
+    ocaml
+    camlp4
+    num
+  ]) ++ [
+    zlib
+  ];
+
+  meta = {
+    description = "Client for many p2p networks, with multiple frontends";
+    homepage = "http://mldonkey.sourceforge.net/";
+    license = lib.licenses.gpl2Only;
+    platforms = lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/applications/networking/p2p/ncdc/default.nix b/nixpkgs/pkgs/applications/networking/p2p/ncdc/default.nix
new file mode 100644
index 000000000000..dd7f4a7bb60f
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/ncdc/default.nix
@@ -0,0 +1,22 @@
+{ lib, stdenv, fetchurl, ncurses, zlib, bzip2, sqlite, pkg-config, glib, gnutls }:
+
+stdenv.mkDerivation rec {
+  pname = "ncdc";
+  version = "1.22.1";
+
+  src = fetchurl {
+    url = "https://dev.yorhel.nl/download/ncdc-${version}.tar.gz";
+    sha256 = "1bdgqd07f026qk6vpbxqsin536znd33931m3b4z44prlm9wd6pyi";
+  };
+
+  nativeBuildInputs = [ pkg-config ];
+  buildInputs = [ ncurses zlib bzip2 sqlite glib gnutls ];
+
+  meta = with lib; {
+    description = "Modern and lightweight direct connect client with a friendly ncurses interface";
+    homepage = "https://dev.yorhel.nl/ncdc";
+    license = licenses.mit;
+    platforms = platforms.linux; # arbitrary
+    maintainers = with maintainers; [ ehmry ];
+  };
+}
diff --git a/nixpkgs/pkgs/applications/networking/p2p/opentracker/default.nix b/nixpkgs/pkgs/applications/networking/p2p/opentracker/default.nix
new file mode 100644
index 000000000000..ac0aeba97215
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/opentracker/default.nix
@@ -0,0 +1,38 @@
+{ lib, stdenv, fetchgit, libowfat, zlib, nixosTests }:
+
+stdenv.mkDerivation {
+  pname = "opentracker";
+  version = "unstable-2018-05-26";
+
+  src = fetchgit {
+    url = "https://erdgeist.org/gitweb/opentracker";
+    rev = "6411f1567f64248b0d145493c2e61004d2822623";
+    sha256 = "110nfb6n4clykwdzpk54iccsfjawq0krjfqhg114i1z0ri5dyl8j";
+  };
+
+  buildInputs = [ libowfat zlib ];
+
+  makeFlags = [
+    "LIBOWFAT_HEADERS=${libowfat}/include/libowfat"
+    "LIBOWFAT_LIBRARY=${libowfat}/lib"
+  ];
+
+  installPhase = ''
+    runHook preInstall
+    install -D opentracker $out/bin/opentracker
+    install -D opentracker.conf.sample $out/share/doc/opentracker.conf.sample
+    runHook postInstall
+  '';
+
+  passthru.tests = {
+    bittorrent-integration = nixosTests.bittorrent;
+  };
+
+  meta = with lib; {
+    homepage = "https://erdgeist.org/arts/software/opentracker/";
+    license = licenses.beerware;
+    platforms = platforms.linux;
+    description = "Bittorrent tracker project which aims for minimal resource usage and is intended to run at your wlan router";
+    maintainers = with maintainers; [ makefu ];
+  };
+}
diff --git a/nixpkgs/pkgs/applications/networking/p2p/qbittorrent/default.nix b/nixpkgs/pkgs/applications/networking/p2p/qbittorrent/default.nix
new file mode 100644
index 000000000000..38e1b7cfceb2
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/qbittorrent/default.nix
@@ -0,0 +1,57 @@
+{ mkDerivation, lib, fetchFromGitHub, makeWrapper, pkg-config
+, boost, libtorrent-rasterbar, qtbase, qttools, qtsvg
+, debugSupport ? false
+, guiSupport ? true, dbus ? null # GUI (disable to run headless)
+, webuiSupport ? true # WebUI
+, trackerSearch ? true, python3 ? null
+}:
+
+assert guiSupport -> (dbus != null);
+assert trackerSearch -> (python3 != null);
+
+with lib;
+mkDerivation rec {
+  pname = "qbittorrent";
+  version = "4.3.8";
+
+  src = fetchFromGitHub {
+    owner = "qbittorrent";
+    repo = "qBittorrent";
+    rev = "release-${version}";
+    sha256 = "sha256-on5folzKuRoVlvDOpme+aWxUKUC5PnO+N3L51qwG2gY=";
+  };
+
+  enableParallelBuilding = true;
+
+  # NOTE: 2018-05-31: CMake is working but it is not officially supported
+  nativeBuildInputs = [ makeWrapper pkg-config ];
+
+  buildInputs = [ boost libtorrent-rasterbar qtbase qttools qtsvg ]
+    ++ optional guiSupport dbus # D(esktop)-Bus depends on GUI support
+    ++ optional trackerSearch python3;
+
+  # Otherwise qm_gen.pri assumes lrelease-qt5, which does not exist.
+  QMAKE_LRELEASE = "lrelease";
+
+  configureFlags = [
+    "--with-boost-libdir=${boost.out}/lib"
+    "--with-boost=${boost.dev}" ]
+    ++ optionals (!guiSupport) [ "--disable-gui" "--enable-systemd" ] # Also place qbittorrent-nox systemd service files
+    ++ optional (!webuiSupport) "--disable-webui"
+    ++ optional debugSupport "--enable-debug";
+
+  postInstall = "wrapProgram $out/bin/${
+    if guiSupport
+    then "qbittorrent"
+    else "qbittorrent-nox"
+  } --prefix PATH : ${makeBinPath [ python3 ]}";
+
+  meta = {
+    description = "Featureful free software BitTorrent client";
+    homepage    = "https://www.qbittorrent.org/";
+    changelog   = "https://github.com/qbittorrent/qBittorrent/blob/release-${version}/Changelog";
+    license     = licenses.gpl2Plus;
+    platforms   = platforms.linux;
+    maintainers = with maintainers; [ Anton-Latukha ];
+  };
+}
diff --git a/nixpkgs/pkgs/applications/networking/p2p/retroshare/default.nix b/nixpkgs/pkgs/applications/networking/p2p/retroshare/default.nix
new file mode 100644
index 000000000000..7a213b880348
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/retroshare/default.nix
@@ -0,0 +1,53 @@
+{ lib, mkDerivation, fetchFromGitHub, qmake, cmake, pkg-config, miniupnpc, bzip2
+, speex, libmicrohttpd, libxml2, libxslt, sqlcipher, rapidjson, libXScrnSaver
+, qtbase, qtx11extras, qtmultimedia, libgnome-keyring3
+}:
+
+mkDerivation rec {
+  pname = "retroshare";
+  version = "0.6.6";
+
+  src = fetchFromGitHub {
+    owner = "RetroShare";
+    repo = "RetroShare";
+    rev = "v${version}";
+    sha256 = "1hsymbhsfgycj39mdkrdp2hgq8irmvxa4a6jx2gg339m1fgf2xmh";
+    fetchSubmodules = true;
+  };
+
+  patches = [
+    # The build normally tries to get git sub-modules during build
+    # but we already have them checked out
+    ./no-submodules.patch
+  ];
+
+  nativeBuildInputs = [ pkg-config qmake cmake ];
+  buildInputs = [
+    speex miniupnpc qtmultimedia qtx11extras qtbase libgnome-keyring3
+    bzip2 libXScrnSaver libxml2 libxslt sqlcipher libmicrohttpd rapidjson
+  ];
+
+  qmakeFlags = [
+    # Upnp library autodetection doesn't work
+    "RS_UPNP_LIB=miniupnpc"
+
+    # These values are normally found from the .git folder
+    "RS_MAJOR_VERSION=${lib.versions.major version}"
+    "RS_MINOR_VERSION=${lib.versions.minor version}"
+    "RS_MINI_VERSION=${lib.versions.patch version}"
+    "RS_EXTRA_VERSION="
+  ];
+
+  postInstall = ''
+    # BT DHT bootstrap
+    cp libbitdht/src/bitdht/bdboot.txt $out/share/retroshare
+  '';
+
+  meta = with lib; {
+    description = "Decentralized peer to peer chat application.";
+    homepage = "https://retroshare.cc/";
+    license = licenses.gpl2Plus;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ StijnDW ];
+  };
+}
diff --git a/nixpkgs/pkgs/applications/networking/p2p/retroshare/no-submodules.patch b/nixpkgs/pkgs/applications/networking/p2p/retroshare/no-submodules.patch
new file mode 100644
index 000000000000..d47268003090
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/retroshare/no-submodules.patch
@@ -0,0 +1,62 @@
+diff --git a/libretroshare/src/libretroshare.pro b/libretroshare/src/libretroshare.pro
+index 84d18944e..71aeb67d2 100644
+--- a/libretroshare/src/libretroshare.pro
++++ b/libretroshare/src/libretroshare.pro
+@@ -870,20 +870,14 @@ rs_jsonapi {
+         genrestbedlib.variable_out = PRE_TARGETDEPS
+         win32-g++:isEmpty(QMAKE_SH) {
+             genrestbedlib.commands = \
+-                cd /D $$shell_path($${RS_SRC_PATH}) && git submodule update --init supportlibs/restbed || cd . $$escape_expand(\\n\\t) \
+-                cd /D $$shell_path($${RESTBED_SRC_PATH}) && git submodule update --init dependency/asio || cd . $$escape_expand(\\n\\t) \
+-                cd /D $$shell_path($${RESTBED_SRC_PATH}) && git submodule update --init dependency/catch || cd . $$escape_expand(\\n\\t )\
+-                cd /D $$shell_path($${RESTBED_SRC_PATH}) && git submodule update --init dependency/kashmir || cd . $$escape_expand(\\n\\t) \
++                cd /D $$shell_path($${RS_SRC_PATH}) && cd . $$escape_expand(\\n\\t) \
++                cd /D $$shell_path($${RESTBED_SRC_PATH}) && cd . $$escape_expand(\\n\\t) \
++                cd /D $$shell_path($${RESTBED_SRC_PATH}) && cd . $$escape_expand(\\n\\t )\
++                cd /D $$shell_path($${RESTBED_SRC_PATH}) && cd . $$escape_expand(\\n\\t) \
+                 $(CHK_DIR_EXISTS) $$shell_path($$UDP_DISCOVERY_BUILD_PATH) $(MKDIR) $$shell_path($${UDP_DISCOVERY_BUILD_PATH}) $$escape_expand(\\n\\t)
+         } else {
+             genrestbedlib.commands = \
+-                cd $${RS_SRC_PATH} && ( \
+-                git submodule update --init supportlibs/restbed ; \
+-                cd $${RESTBED_SRC_PATH} ; \
+-                git submodule update --init dependency/asio ; \
+-                git submodule update --init dependency/catch ; \
+-                git submodule update --init dependency/kashmir ; \
+-                true ) && \
++                cd $${RS_SRC_PATH} && \
+                 mkdir -p $${RESTBED_BUILD_PATH} &&
+         }
+         genrestbedlib.commands += \
+@@ -991,14 +985,9 @@ rs_broadcast_discovery {
+         udpdiscoverycpplib.variable_out = PRE_TARGETDEPS
+         win32-g++:isEmpty(QMAKE_SH) {
+             udpdiscoverycpplib.commands = \
+-                cd /D $$shell_path($${RS_SRC_PATH}) && git submodule update --init supportlibs/udp-discovery-cpp || cd . $$escape_expand(\\n\\t) \
+                 $(CHK_DIR_EXISTS) $$shell_path($$UDP_DISCOVERY_BUILD_PATH) $(MKDIR) $$shell_path($${UDP_DISCOVERY_BUILD_PATH}) $$escape_expand(\\n\\t)
+         } else {
+-            udpdiscoverycpplib.commands = \
+-                cd $${RS_SRC_PATH} && ( \
+-                git submodule update --init supportlibs/udp-discovery-cpp || \
+-                true ) && \
+-                mkdir -p $${UDP_DISCOVERY_BUILD_PATH} &&
++            udpdiscoverycpplib.commands = mkdir -p $${UDP_DISCOVERY_BUILD_PATH} &&
+         }
+         udpdiscoverycpplib.commands += \
+             cd $$shell_path($${UDP_DISCOVERY_BUILD_PATH}) && \
+diff --git a/retroshare-gui/src/retroshare-gui.pro b/retroshare-gui/src/retroshare-gui.pro
+index 654efd170..06cba9ba3 100644
+--- a/retroshare-gui/src/retroshare-gui.pro
++++ b/retroshare-gui/src/retroshare-gui.pro
+@@ -66,10 +66,7 @@ rs_gui_cmark {
+ 		gencmarklib.CONFIG += target_predeps combine
+ 		gencmarklib.variable_out = PRE_TARGETDEPS
+ 		gencmarklib.commands = \
+-		    cd $${RS_SRC_PATH} && ( \
+-		    git submodule update --init supportlibs/cmark ; \
+-		    cd $${CMARK_SRC_PATH} ; \
+-		    true ) && \
++		    cd $${RS_SRC_PATH} && \
+ 		    mkdir -p $${CMARK_BUILD_PATH} && cd $${CMARK_BUILD_PATH} && \
+ 		    cmake \
+ 		        -DCMAKE_CXX_COMPILER=$$QMAKE_CXX \
diff --git a/nixpkgs/pkgs/applications/networking/p2p/soulseekqt/default.nix b/nixpkgs/pkgs/applications/networking/p2p/soulseekqt/default.nix
new file mode 100644
index 000000000000..0d2fc0fd833c
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/soulseekqt/default.nix
@@ -0,0 +1,59 @@
+{ stdenv, lib, fetchzip, mkDerivation
+, appimageTools
+, autoPatchelfHook
+, desktop-file-utils
+, imagemagick
+, qtmultimedia
+}:
+
+mkDerivation rec {
+  pname = "soulseekqt";
+  version = "2018-1-30";
+  name="${pname}-${version}";
+
+  src = fetchzip {
+      url = "https://www.slsknet.org/SoulseekQt/Linux/SoulseekQt-${version}-64bit-appimage.tgz";
+      sha256 = "16ncnvv8h33f161mgy7qc0wjvvqahsbwvby65qhgfh9pbbgb4xgg";
+  };
+
+  appextracted = appimageTools.extractType2 {
+    inherit name;
+    src="${src}/SoulseekQt-2018-1-30-64bit.AppImage";
+  };
+
+  dontBuild = true;
+  dontConfigure = true;
+
+  nativeBuildInputs = [ imagemagick autoPatchelfHook desktop-file-utils ];
+  buildInputs = [ qtmultimedia stdenv.cc.cc ];
+
+  installPhase = ''
+      # directory in /nix/store so readonly
+      cd $appextracted
+
+      binary="$(readlink AppRun)"
+      install -Dm755 $binary -t $out/bin
+
+      # fixup and install desktop file
+      desktop-file-install --dir $out/share/applications \
+        --set-key Exec --set-value $binary \
+        --set-key Comment --set-value "${meta.description}" \
+        --set-key Categories --set-value Network default.desktop
+      mv $out/share/applications/default.desktop $out/share/applications/SoulseekQt.desktop
+
+      #TODO: write generic code to read icon path from $binary.desktop
+      icon="$(readlink .DirIcon)"
+      for size in 16 32 48 64 72 96 128 192 256 512 1024; do
+        mkdir -p $out/share/icons/hicolor/"$size"x"$size"/apps
+        convert -resize "$size"x"$size" $icon $out/share/icons/hicolor/"$size"x"$size"/apps/$icon
+      done
+    '';
+
+  meta = with lib; {
+    description = "Official Qt SoulSeek client";
+    homepage = "https://www.slsknet.org";
+    license = licenses.unfree;
+    maintainers = [ ];
+    platforms = [ "x86_64-linux" ];
+  };
+}
diff --git a/nixpkgs/pkgs/applications/networking/p2p/stig/default.nix b/nixpkgs/pkgs/applications/networking/p2p/stig/default.nix
new file mode 100644
index 000000000000..6c09043a65b9
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/stig/default.nix
@@ -0,0 +1,68 @@
+{ lib, stdenv
+, fetchFromGitHub
+, python3Packages
+}:
+
+python3Packages.buildPythonApplication rec {
+  pname = "stig";
+  # This project has a different concept for pre release / alpha,
+  # Read the project's README for details: https://github.com/rndusr/stig#stig
+  version = "0.11.2a0";
+
+  src = fetchFromGitHub {
+    owner = "rndusr";
+    repo = "stig";
+    rev = "v${version}";
+    sha256 = "05dn6mr86ly65gdqarl16a2jk1bwiw5xa6r4kyag3s6lqsv66iw8";
+  };
+
+  # urwidtrees 1.0.3 is requested by the developer because 1.0.2 (which is packaged
+  # in nixpkgs) is not uploaded to pypi and 1.0.1 has a problematic `setup.py`.
+  # As long as we don't have any problems installing it, no special features / specific bugs
+  # were fixed in 1.0.3 that aren't available in 1.0.2 are used by stig.
+  # See https://github.com/rndusr/stig/issues/120
+  postPatch = ''
+    substituteInPlace setup.py \
+      --replace "urwidtrees>=1.0.3dev0" "urwidtrees"
+  '';
+
+  propagatedBuildInputs = with python3Packages; [
+    urwid
+    urwidtrees
+    aiohttp
+    async-timeout
+    pyxdg
+    blinker
+    natsort
+    setproctitle
+  ];
+
+  checkInputs = with python3Packages; [
+    asynctest
+    pytestCheckHook
+  ];
+
+  dontUseSetuptoolsCheck = true;
+
+  preCheck = ''
+    export LC_ALL=C
+  '';
+
+  pytestFlagsArray = [
+    "tests"
+    # test_string__month_day_hour_minute_second fails on darwin
+    "--deselect=tests/client_test/ttypes_test.py::TestTimestamp::test_string__month_day_hour_minute_second"
+    # TestScrollBarWithScrollable.test_wrapping_bug fails
+    "--deselect=tests/tui_test/scroll_test.py::TestScrollBarWithScrollable::test_wrapping_bug"
+  ] ++ lib.optionals stdenv.isDarwin [
+    "--deselect=tests/client_test/aiotransmission_test/api_torrent_test.py"
+    "--deselect=tests/client_test/aiotransmission_test/rpc_test.py"
+  ];
+
+  meta = with lib; {
+    description = "TUI and CLI for the BitTorrent client Transmission";
+    homepage = "https://github.com/rndusr/stig";
+    license = licenses.gpl3;
+    maintainers = with maintainers; [ doronbehar ];
+  };
+}
diff --git a/nixpkgs/pkgs/applications/networking/p2p/synapse-bt/default.nix b/nixpkgs/pkgs/applications/networking/p2p/synapse-bt/default.nix
new file mode 100644
index 000000000000..c7104d9011d8
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/synapse-bt/default.nix
@@ -0,0 +1,28 @@
+{ lib, stdenv, fetchFromGitHub, rustPlatform, pkg-config, openssl, CoreServices, Security }:
+
+rustPlatform.buildRustPackage rec {
+  pname = "synapse-bt";
+  version = "1.0";
+
+  src = fetchFromGitHub {
+    owner = "Luminarys";
+    repo = "synapse";
+    rev = version;
+    sha256 = "01npv3zwia5d534zdwisd9xfng507adv4qkljf8z0zm0khqqn71a";
+  };
+
+  cargoSha256 = "0sy0vlpkj967g9lyyh7ska8cpw5xh0g04kj071a32idrqc3dcjb1";
+
+  nativeBuildInputs = [ pkg-config ];
+  buildInputs = [ openssl ]
+    ++ lib.optionals stdenv.isDarwin [ CoreServices Security ];
+
+  cargoBuildFlags = [ "--all" ];
+
+  meta = with lib; {
+    description = "Flexible and fast BitTorrent daemon";
+    homepage = "https://synapse-bt.org/";
+    license = licenses.isc;
+    maintainers = with maintainers; [ dywedir ];
+  };
+}
diff --git a/nixpkgs/pkgs/applications/networking/p2p/tixati/default.nix b/nixpkgs/pkgs/applications/networking/p2p/tixati/default.nix
new file mode 100644
index 000000000000..e5c17581cb52
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/tixati/default.nix
@@ -0,0 +1,30 @@
+{ lib, stdenv, fetchurl, glib, zlib, dbus, dbus-glib, gtk2, gdk-pixbuf, cairo, pango }:
+
+stdenv.mkDerivation rec {
+  pname = "tixati";
+  version = "2.84";
+
+  src = fetchurl {
+    url = "https://download2.tixati.com/download/tixati-${version}-1.x86_64.manualinstall.tar.gz";
+    sha256 = "sha256-l3giWCMymUk5z4r4sEBZoeCh3K8jAp8TSf+xvhjeAEU=";
+  };
+
+  installPhase = ''
+    patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
+             --set-rpath ${lib.makeLibraryPath [ glib zlib dbus dbus-glib gtk2 gdk-pixbuf cairo pango ]} \
+             tixati
+    install -D tixati         $out/bin/tixati
+    install -D tixati.desktop $out/share/applications/tixati.desktop
+    install -D tixati.png     $out/share/icons/tixati.png
+  '';
+
+  dontStrip = true;
+
+  meta = with lib; {
+    description = "Torrent client";
+    homepage = "http://www.tixati.com";
+    license = licenses.unfree;
+    platforms = [ "x86_64-linux" ];
+    maintainers = with maintainers; [ volth ];
+  };
+}
diff --git a/nixpkgs/pkgs/applications/networking/p2p/torrential/default.nix b/nixpkgs/pkgs/applications/networking/p2p/torrential/default.nix
new file mode 100644
index 000000000000..7290ec65ad56
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/torrential/default.nix
@@ -0,0 +1,81 @@
+{ lib, stdenv
+, fetchFromGitHub
+, nix-update-script
+, desktop-file-utils
+, meson
+, ninja
+, pkg-config
+, python3
+, vala
+, wrapGAppsHook
+, curl
+, dht
+, glib
+, gtk3
+, libb64
+, libevent
+, libgee
+, libnatpmp
+, libtransmission
+, libutp
+, miniupnpc
+, openssl
+, pantheon
+}:
+
+stdenv.mkDerivation rec {
+  pname = "torrential";
+  version = "2.0.0";
+
+  src = fetchFromGitHub {
+    owner = "davidmhewitt";
+    repo = "torrential";
+    rev = version;
+    sha256 = "sha256-78eNIz7Lgeq4LTog04TMNuL27Gv0UZ0poBaw8ia1R/g=";
+  };
+
+  nativeBuildInputs = [
+    desktop-file-utils
+    meson
+    ninja
+    pkg-config
+    python3
+    vala
+    wrapGAppsHook
+  ];
+
+  buildInputs = [
+    curl
+    dht
+    glib
+    gtk3
+    libb64
+    libevent
+    libgee
+    libnatpmp
+    libtransmission
+    libutp
+    miniupnpc
+    openssl
+    pantheon.granite
+  ];
+
+  postPatch = ''
+    chmod +x meson/post_install.py
+    patchShebangs meson/post_install.py
+  '';
+
+  passthru = {
+    updateScript = nix-update-script {
+      attrPath = pname;
+    };
+  };
+
+  meta = with lib; {
+    description = "Download torrents in style with this speedy, minimalist torrent client for elementary OS";
+    homepage = "https://github.com/davidmhewitt/torrential";
+    maintainers = with maintainers; [ xiorcale ] ++ teams.pantheon.members;
+    platforms = platforms.linux;
+    license = licenses.gpl2Plus;
+  };
+}
diff --git a/nixpkgs/pkgs/applications/networking/p2p/transgui/default.nix b/nixpkgs/pkgs/applications/networking/p2p/transgui/default.nix
new file mode 100644
index 000000000000..0a2f90ecb711
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/transgui/default.nix
@@ -0,0 +1,77 @@
+{ lib, stdenv, fetchFromGitHub, pkg-config, makeDesktopItem, unzip, fpc, lazarus,
+libX11, glib, gtk2, gdk-pixbuf, pango, atk, cairo, openssl }:
+
+stdenv.mkDerivation rec {
+  pname = "transgui";
+  version = "5.18.0";
+
+  src = fetchFromGitHub {
+    owner = "transmission-remote-gui";
+    repo = "transgui";
+    rev = "v${version}";
+    sha256 = "1dyx778756zhvz5sxgdvy49p2c0x44w4nmcfd90wqrmgfknncnf5";
+  };
+
+  nativeBuildInputs = [ pkg-config unzip ];
+  buildInputs = [
+    fpc lazarus stdenv.cc
+    libX11 glib gtk2 gdk-pixbuf pango atk cairo openssl
+  ];
+
+  NIX_LDFLAGS = "
+    -L${stdenv.cc.cc.lib}/lib
+    -lX11 -lglib-2.0 -lgtk-x11-2.0 -lgdk-x11-2.0
+    -lgdk_pixbuf-2.0 -lpango-1.0 -latk-1.0 -lcairo -lc -lcrypto
+  ";
+
+  prePatch = ''
+    substituteInPlace restranslator.pas --replace /usr/ $out/
+  '';
+
+  preBuild = ''
+    FPCDIR=${fpc}/lib/fpc/${fpc.version} fpcmake -w
+    lazbuild -B transgui.lpr --lazarusdir=${lazarus}/share/lazarus
+  '';
+
+  makeFlags = [
+    "FPC=fpc"
+    "PP=fpc"
+    "INSTALL_PREFIX=$(out)"
+  ];
+
+  LCL_PLATFORM = "gtk2";
+
+  desktopItem = makeDesktopItem rec {
+    name = "transgui";
+    exec = name + " %U";
+    icon = name;
+    type = "Application";
+    comment = meta.description;
+    desktopName = "Transmission Remote GUI";
+    genericName = "BitTorrent Client";
+    categories = lib.concatStringsSep ";" [
+      "Application" "Network" "FileTransfer" "P2P" "GTK"
+    ];
+    startupNotify = "true";
+    mimeType = lib.concatStringsSep ";" [
+      "application/x-bittorrent" "x-scheme-handler/magnet"
+    ];
+  };
+
+  postInstall = ''
+    mkdir -p "$out/share/applications"
+    cp $desktopItem/share/applications/* $out/share/applications
+    mkdir -p "$out/share/icons/hicolor/48x48/apps"
+    cp transgui.png "$out/share/icons/hicolor/48x48/apps"
+    mkdir -p "$out/share/transgui"
+    cp -r "./lang" "$out/share/transgui"
+  '';
+
+  meta = {
+    description = "A cross platform front-end for the Transmission Bit-Torrent client";
+    homepage = "https://sourceforge.net/p/transgui";
+    license = lib.licenses.gpl2Plus;
+    maintainers = with lib.maintainers; [ ramkromberg ];
+    platforms = lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/applications/networking/p2p/transmission-remote-gtk/default.nix b/nixpkgs/pkgs/applications/networking/p2p/transmission-remote-gtk/default.nix
new file mode 100644
index 000000000000..c89e53977067
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/transmission-remote-gtk/default.nix
@@ -0,0 +1,42 @@
+{ lib, stdenv, autoconf, automake, libtool, wrapGAppsHook, fetchFromGitHub, pkg-config
+, intltool, gtk3, json-glib, curl, glib, autoconf-archive, appstream-glib, fetchpatch }:
+
+
+stdenv.mkDerivation rec {
+  pname = "transmission-remote-gtk";
+  version = "1.4.1";
+
+  src = fetchFromGitHub {
+    owner = "transmission-remote-gtk";
+    repo = "transmission-remote-gtk";
+    rev = version;
+    sha256 = "1pipc1f94jdppv597mqmcj2kw2rdvaqcbl512v7z8vir76p1a7gk";
+  };
+
+  patches = [
+    (fetchpatch {
+      url = "https://github.com/transmission-remote-gtk/transmission-remote-gtk/commit/0f5cc8a9942e220ea0f7d0b17db4a78d094e3b65.patch";
+      sha256 = "195rsjpbc0gzmr9bycvq4mra7abp3hd9by3a5vvcmxsh5ipikycf";
+    })
+  ];
+
+  preConfigure = "./autogen.sh";
+
+  nativeBuildInputs= [
+    autoconf automake libtool wrapGAppsHook
+    pkg-config intltool autoconf-archive
+    appstream-glib
+  ];
+
+  buildInputs = [ gtk3 json-glib curl glib ];
+
+  doCheck = false; # fails with style validation error
+
+  meta = with lib; {
+    description = "GTK remote control for the Transmission BitTorrent client";
+    homepage = "https://github.com/ajf8/transmission-remote-gtk";
+    license = licenses.gpl2;
+    maintainers = [ maintainers.ehmry ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/applications/networking/p2p/transmission/default.nix b/nixpkgs/pkgs/applications/networking/p2p/transmission/default.nix
new file mode 100644
index 000000000000..312023566b02
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/transmission/default.nix
@@ -0,0 +1,142 @@
+{ stdenv
+, lib
+, fetchFromGitHub
+, cmake
+, pkg-config
+, openssl
+, curl
+, libevent
+, inotify-tools
+, systemd
+, zlib
+, pcre
+, libb64
+, libutp
+, miniupnpc
+, dht
+, libnatpmp
+  # Build options
+, enableGTK3 ? false
+, gtk3
+, xorg
+, wrapGAppsHook
+, enableQt ? false
+, qt5
+, nixosTests
+, enableSystemd ? stdenv.isLinux
+, enableDaemon ? true
+, enableCli ? true
+, installLib ? false
+, apparmorRulesFromClosure
+}:
+
+let
+  version = "3.00";
+
+in stdenv.mkDerivation {
+  pname = "transmission";
+  inherit version;
+
+  src = fetchFromGitHub {
+    owner = "transmission";
+    repo = "transmission";
+    rev = version;
+    sha256 = "0ccg0km54f700x9p0jsnncnwvfnxfnxf7kcm7pcx1cj0vw78924z";
+    fetchSubmodules = true;
+  };
+
+  outputs = [ "out" "apparmor" ];
+
+  cmakeFlags =
+    let
+      mkFlag = opt: if opt then "ON" else "OFF";
+    in
+    [
+      "-DENABLE_MAC=OFF" # requires xcodebuild
+      "-DENABLE_GTK=${mkFlag enableGTK3}"
+      "-DENABLE_QT=${mkFlag enableQt}"
+      "-DENABLE_DAEMON=${mkFlag enableDaemon}"
+      "-DENABLE_CLI=${mkFlag enableCli}"
+      "-DINSTALL_LIB=${mkFlag installLib}"
+    ];
+
+  nativeBuildInputs = [
+    pkg-config
+    cmake
+  ]
+  ++ lib.optionals enableGTK3 [ wrapGAppsHook ]
+  ++ lib.optionals enableQt [ qt5.wrapQtAppsHook ]
+  ;
+
+  buildInputs = [
+    openssl
+    curl
+    libevent
+    zlib
+    pcre
+    libb64
+    libutp
+    miniupnpc
+    dht
+    libnatpmp
+  ]
+  ++ lib.optionals enableQt [ qt5.qttools qt5.qtbase ]
+  ++ lib.optionals enableGTK3 [ gtk3 xorg.libpthreadstubs ]
+  ++ lib.optionals enableSystemd [ systemd ]
+  ++ lib.optionals stdenv.isLinux [ inotify-tools ]
+  ;
+
+  NIX_LDFLAGS = lib.optionalString stdenv.isDarwin "-framework CoreFoundation";
+
+  postInstall = ''
+    mkdir $apparmor
+    cat >$apparmor/bin.transmission-daemon <<EOF
+    include <tunables/global>
+    $out/bin/transmission-daemon {
+      include <abstractions/base>
+      include <abstractions/nameservice>
+      include <abstractions/ssl_certs>
+      include "${apparmorRulesFromClosure { name = "transmission-daemon"; } ([
+        curl libevent openssl pcre zlib libnatpmp miniupnpc
+      ] ++ lib.optionals enableSystemd [ systemd ]
+        ++ lib.optionals stdenv.isLinux [ inotify-tools ]
+      )}"
+      r @{PROC}/sys/kernel/random/uuid,
+      r @{PROC}/sys/vm/overcommit_memory,
+      r @{PROC}/@{pid}/environ,
+      r @{PROC}/@{pid}/mounts,
+      rwk /tmp/tr_session_id_*,
+      r /run/systemd/resolve/stub-resolv.conf,
+
+      r $out/share/transmission/web/**,
+
+      include <local/bin.transmission-daemon>
+    }
+    EOF
+  '';
+
+  passthru.tests = {
+    apparmor = nixosTests.transmission; # starts the service with apparmor enabled
+    smoke-test = nixosTests.bittorrent;
+  };
+
+  meta = {
+    description = "A fast, easy and free BitTorrent client";
+    longDescription = ''
+      Transmission is a BitTorrent client which features a simple interface
+      on top of a cross-platform back-end.
+      Feature spotlight:
+        * Uses fewer resources than other clients
+        * Native Mac, GTK and Qt GUI clients
+        * Daemon ideal for servers, embedded systems, and headless use
+        * All these can be remote controlled by Web and Terminal clients
+        * Bluetack (PeerGuardian) blocklists with automatic updates
+        * Full encryption, DHT, and PEX support
+    '';
+    homepage = "http://www.transmissionbt.com/";
+    license = lib.licenses.gpl2Plus; # parts are under MIT
+    maintainers = with lib.maintainers; [ astsmtl vcunat wizeman ];
+    platforms = lib.platforms.unix;
+  };
+
+}
diff --git a/nixpkgs/pkgs/applications/networking/p2p/tremc/default.nix b/nixpkgs/pkgs/applications/networking/p2p/tremc/default.nix
new file mode 100644
index 000000000000..ea6b92c08e7e
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/tremc/default.nix
@@ -0,0 +1,59 @@
+{ lib, stdenv, fetchFromGitHub, fetchpatch, python3Packages
+, x11Support ? !stdenv.isDarwin
+, xclip ? null
+, pbcopy ? null
+, useGeoIP ? false # Require /var/lib/geoip-databases/GeoIP.dat
+}:
+let
+  wrapperPath = with lib; makeBinPath (
+    optional x11Support xclip ++
+    optional stdenv.isDarwin pbcopy
+  );
+in
+python3Packages.buildPythonApplication rec {
+  pname = "tremc";
+  version = "0.9.2";
+
+  src = fetchFromGitHub {
+    owner = "tremc";
+    repo = pname;
+    rev = version;
+    sha256 = "1fqspp2ckafplahgba54xmx0sjidx1pdzyjaqjhz0ivh98dkx2n5";
+  };
+
+  patches = [
+    # Remove when version >0.9.2 is released
+    (fetchpatch {
+      url = "https://github.com/tremc/tremc/commit/bdffff2bd76186a4e3488b83f719fc7f7e3362b6.patch";
+      sha256 = "1zip2skh22v0yyv2hmszxn5jshp9m1jpw0fsyfvmqfxzq7m3czy5";
+      name = "replace-decodestring-with-decodebytes.patch";
+    })
+  ];
+
+  buildInputs = with python3Packages; [
+    python
+    wrapPython
+  ];
+
+  pythonPath = with python3Packages; [
+    ipy
+    pyperclip
+  ] ++
+  lib.optional useGeoIP GeoIP;
+
+  dontBuild = true;
+  doCheck = false;
+
+  makeWrapperArgs = ["--prefix PATH : ${wrapperPath}"];
+
+  installPhase = ''
+    make DESTDIR=$out install
+    wrapPythonPrograms
+  '';
+
+  meta = with lib; {
+    description = "Curses interface for transmission";
+    homepage = "https://github.com/tremc/tremc";
+    license = licenses.gpl3Plus;
+  };
+}
diff --git a/nixpkgs/pkgs/applications/networking/p2p/tribler/default.nix b/nixpkgs/pkgs/applications/networking/p2p/tribler/default.nix
new file mode 100644
index 000000000000..3aa5b4a8da82
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/tribler/default.nix
@@ -0,0 +1,90 @@
+{ stdenv, fetchurl, python3Packages, makeWrapper
+, enablePlayer ? true, libvlc, qt5, lib }:
+
+stdenv.mkDerivation rec {
+  pname = "tribler";
+  version = "7.4.4";
+
+  src = fetchurl {
+    url = "https://github.com/Tribler/tribler/releases/download/v${version}/Tribler-v${version}.tar.xz";
+    sha256 = "0hxiyf1k07ngym2p8r1b5mcx1y2crkyz43gi9sgvsvsyijyaff3p";
+  };
+
+  nativeBuildInputs = [
+    python3Packages.wrapPython
+    makeWrapper
+  ];
+
+  buildInputs = [
+    python3Packages.python
+  ];
+
+  pythonPath = with python3Packages; [
+    libtorrent-rasterbar
+    twisted
+    netifaces
+    pycrypto
+    pyasn1
+    requests
+    m2crypto
+    pyqt5
+    chardet
+    cherrypy
+    cryptography
+    libnacl
+    configobj
+    decorator
+    feedparser
+    service-identity
+    psutil
+    pillow
+    networkx
+    pony
+    lz4
+    pyqtgraph
+
+    # there is a BTC feature, but it requires some unclear version of
+    # bitcoinlib, so this doesn't work right now.
+    # bitcoinlib
+  ];
+
+  postPatch = ''
+    ${lib.optionalString enablePlayer ''
+      substituteInPlace "./TriblerGUI/vlc.py" --replace "ctypes.CDLL(p)" "ctypes.CDLL('${libvlc}/lib/libvlc.so')"
+      substituteInPlace "./TriblerGUI/widgets/videoplayerpage.py" \
+        --replace "if vlc and vlc.plugin_path" "if vlc" \
+        --replace "os.environ['VLC_PLUGIN_PATH'] = vlc.plugin_path" "os.environ['VLC_PLUGIN_PATH'] = '${libvlc}/lib/vlc/plugins'"
+    ''}
+  '';
+
+  installPhase = ''
+    mkdir -pv $out
+    # Nasty hack; call wrapPythonPrograms to set program_PYTHONPATH.
+    wrapPythonPrograms
+    cp -prvd ./* $out/
+    makeWrapper ${python3Packages.python}/bin/python $out/bin/tribler \
+        --set QT_QPA_PLATFORM_PLUGIN_PATH ${qt5.qtbase.bin}/lib/qt-*/plugins/platforms \
+        --set _TRIBLERPATH $out \
+        --set PYTHONPATH $out:$program_PYTHONPATH \
+        --set NO_AT_BRIDGE 1 \
+        --run 'cd $_TRIBLERPATH' \
+        --add-flags "-O $out/run_tribler.py" \
+        ${lib.optionalString enablePlayer ''
+          --prefix LD_LIBRARY_PATH : ${libvlc}/lib
+        ''}
+
+    mkdir -p $out/share/applications $out/share/icons $out/share/man/man1
+    cp $out/Tribler/Main/Build/Ubuntu/tribler.desktop $out/share/applications/tribler.desktop
+    cp $out/Tribler/Main/Build/Ubuntu/tribler_big.xpm $out/share/icons/tribler.xpm
+    cp $out/Tribler/Main/Build/Ubuntu/tribler.1 $out/share/man/man1/tribler.1
+  '';
+
+  meta = with lib; {
+    maintainers = with maintainers; [ xvapx ];
+    homepage = "https://www.tribler.org/";
+    description = "A completely decentralised P2P filesharing client based on the Bittorrent protocol";
+    license = licenses.lgpl21;
+    platforms = platforms.linux;
+    broken = true; # 2021-03-17 see https://github.com/NixOS/nixpkgs/issues/93053
+  };
+}
diff --git a/nixpkgs/pkgs/applications/networking/p2p/twister/default.nix b/nixpkgs/pkgs/applications/networking/p2p/twister/default.nix
new file mode 100644
index 000000000000..1d05cafef832
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/twister/default.nix
@@ -0,0 +1,67 @@
+{ lib, stdenv, fetchFromGitHub, fetchpatch, autoconf, automake, libtool, pkg-config, python2
+, boost, db, openssl, geoip, libiconv, miniupnpc
+, srcOnly, fetchgit
+}:
+
+let
+  twisterHTML = srcOnly {
+    name = "twister-html";
+    src = fetchgit {
+      url = "git://github.com/miguelfreitas/twister-html.git";
+      rev = "01e7f7ca9b7e42ed90f91bc42da2c909ca5c0b9b";
+      sha256 = "0scjbin6s1kmi0bqq0dx0qyjw4n5xgmj567n0156i39f9h0dabqy";
+    };
+  };
+
+  boostPython = boost.override { enablePython = true; };
+
+in stdenv.mkDerivation rec {
+  pname = "twister";
+  version = "2019-08-19";
+
+  src = fetchFromGitHub {
+    owner = "miguelfreitas";
+    repo = "twister-core";
+    rev = "31faf3f63e461ea0a9b23081567a4a552cf06873";
+    sha256 = "0xh1lgnl9nd86jr0mp7m8bkd7r5j4d6chd0y73h2xv4aq5sld0sp";
+  };
+
+  configureFlags = [
+    "--with-libgeoip"
+    "--with-libiconv"
+    "--disable-deprecated-functions"
+    "--enable-tests"
+    "--enable-python-binding"
+    "--with-boost-libdir=${boostPython.out}/lib"
+  ];
+
+  nativeBuildInputs = [ pkg-config ];
+  buildInputs = [
+    autoconf automake libtool python2
+    boostPython db openssl geoip miniupnpc libiconv
+  ];
+
+  postPatch = ''
+    sed -i -e '/-htmldir/s|(default: [^)]*)|(default: ${twisterHTML})|' \
+      src/init.cpp
+    sed -i -e '/GetDataDir.*html/s|path *= *[^;]*|path = "${twisterHTML}"|' \
+      src/util.cpp
+  '';
+
+  preConfigure = ''
+    sh autotool.sh
+  '';
+
+  installPhase = ''
+    install -vD twisterd "$out/bin/twisterd"
+  '';
+
+  enableParallelBuilding = true;
+
+  meta = {
+    homepage = "http://www.twister.net.co/";
+    description = "Peer-to-peer microblogging";
+    license = lib.licenses.mit;
+    platforms = lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/applications/networking/p2p/vuze/default.nix b/nixpkgs/pkgs/applications/networking/p2p/vuze/default.nix
new file mode 100644
index 000000000000..fe8743ee1cd1
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/vuze/default.nix
@@ -0,0 +1,30 @@
+{ lib, stdenv, fetchsvn, jdk, jre, ant, swt, makeWrapper }:
+
+stdenv.mkDerivation rec {
+  pname = "vuze";
+  version = "5750";
+
+  src = fetchsvn {
+    url = "http://svn.vuze.com/public/client/tags/RELEASE_${version}";
+    sha256 = "07w6ipyiy8hi88d6yxbbf3vkv26mj7dcz9yr8141hb2ig03v0h0p";
+  };
+
+  nativeBuildInputs = [ makeWrapper ];
+  buildInputs = [ jdk ant ];
+
+  buildPhase = "ant";
+
+  installPhase = ''
+    install -D dist/Vuze_0000-00.jar $out/share/java/Vuze_${version}-00.jar
+    makeWrapper ${jre}/bin/java $out/bin/vuze \
+      --add-flags "-Xmx256m -Djava.library.path=${swt}/lib -cp $out/share/java/Vuze_${version}-00.jar:${swt}/jars/swt.jar org.gudy.azureus2.ui.swt.Main"
+  '';
+
+  meta = with lib; {
+    description = "Torrent client";
+    homepage = "http://www.vuze.com";
+    license = licenses.unfree;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ volth ];
+  };
+}
diff --git a/nixpkgs/pkgs/applications/networking/p2p/xd/default.nix b/nixpkgs/pkgs/applications/networking/p2p/xd/default.nix
new file mode 100644
index 000000000000..54581a6070ba
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/xd/default.nix
@@ -0,0 +1,29 @@
+{ pkgs, buildGoModule, fetchFromGitHub, lib, perl }:
+
+buildGoModule rec {
+  pname = "XD";
+  version = "0.4.0";
+
+  src = fetchFromGitHub {
+    owner = "majestrate";
+    repo = "XD";
+    rev = "v${version}";
+    sha256 = "sha256-fXENoqhR04TYS/kAJUqsqa0+j+KyzdsMlXIZ2GMPMhc=";
+  };
+
+  vendorSha256 = "1wg3cym2rwrhjsqlgd38l8mdq5alccz808465117n3vyga9m35lq";
+
+  checkInputs = [ perl ];
+
+  postInstall = ''
+    ln -s $out/bin/XD $out/bin/XD-CLI
+  '';
+
+  meta = with lib; {
+    description = "i2p bittorrent client";
+    homepage = "https://xd-torrent.github.io";
+    maintainers = with maintainers; [ nixbitcoin ];
+    license = licenses.mit;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/applications/networking/p2p/zeronet/default.nix b/nixpkgs/pkgs/applications/networking/p2p/zeronet/default.nix
new file mode 100644
index 000000000000..19da740938c7
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/zeronet/default.nix
@@ -0,0 +1,41 @@
+{ lib, fetchFromGitHub, python3Packages }:
+
+python3Packages.buildPythonApplication rec {
+  pname = "zeronet";
+  version = "0.7.1";
+  format = "other";
+
+  src = fetchFromGitHub {
+    owner = "HelloZeroNet";
+    repo = "ZeroNet";
+    rev = "v${version}";
+    sha256 = "04prgicm0yjh2klcxdgwx1mvlsxxi2bdkzfcvysvixbgq20wjvdk";
+  };
+
+  propagatedBuildInputs = with python3Packages; [
+    gevent msgpack base58 merkletools rsa pysocks pyasn1 websocket-client
+    gevent-websocket rencode bitcoinlib maxminddb pyopenssl
+  ];
+
+  buildPhase = ''
+    ${python3Packages.python.interpreter} -O -m compileall .
+  '';
+
+  installPhase = ''
+    mkdir -p $out/share
+    cp -r plugins src tools *.py $out/share/
+  '';
+
+  postFixup = ''
+    makeWrapper "$out/share/zeronet.py" "$out/bin/zeronet" \
+      --set PYTHONPATH "$PYTHONPATH" \
+      --set PATH ${python3Packages.python}/bin
+  '';
+
+  meta = with lib; {
+    description = "Decentralized websites using Bitcoin crypto and BitTorrent network";
+    homepage = "https://zeronet.io/";
+    license = licenses.gpl2;
+    maintainers = with maintainers; [ fgaz ];
+  };
+}