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.nix104
-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/enhanced-ctorrent/default.nix36
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/flood-for-transmission/default.nix37
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/flood/default.nix26
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/fragments/default.nix87
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/freenet/default.nix126
-rwxr-xr-xnixpkgs/pkgs/applications/networking/p2p/freenet/freenetWrapper18
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/frostwire/default.nix99
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/frostwire/frostwire-bin.nix46
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/gnunet/default.nix75
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/gnunet/gtk.nix51
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/jesec-rtorrent/avoid-stack-overflow-for-lockfile-buf.patch30
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/jesec-rtorrent/default.nix74
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/jesec-rtorrent/libtorrent.nix48
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/libutp/3.4.nix30
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/libutp/default.nix24
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/lokinet/default.nix76
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/magnetico/default.nix45
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/mldonkey/default.nix46
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/opentracker/default.nix38
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/pyrosimple/default.nix69
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/qbittorrent/default.nix100
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/rakshasa-rtorrent/default.nix73
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/rakshasa-rtorrent/libtorrent.nix48
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/retroshare/cpp-filesystem.patch12
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/retroshare/default.nix63
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/retroshare/no-submodules.patch62
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/soulseekqt/default.nix57
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/stig/default.nix67
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/storrent/default.nix25
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/synapse-bt/default.nix28
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/torrential/default.nix84
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/transgui/default.nix73
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/transmission-remote-gtk/default.nix68
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/transmission/4.nix169
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/transmission/default.nix147
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/tremc/default.nix61
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/tremotesf/default.nix52
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/tribler/default.nix116
-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-conservancy/default.nix60
-rw-r--r--nixpkgs/pkgs/applications/networking/p2p/zeronet/default.nix45
45 files changed, 2730 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..35db62ef8e4e
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/deluge/default.nix
@@ -0,0 +1,104 @@
+{ lib
+, fetchurl
+, intltool
+, libtorrent-rasterbar
+, python3Packages
+, gtk3
+, glib
+, gobject-introspection
+, librsvg
+, wrapGAppsHook
+}:
+
+let
+  inherit (lib) optionals;
+
+  pypkgs = python3Packages;
+
+  generic = { pname, withGUI }:
+    pypkgs.buildPythonPackage rec {
+      inherit pname;
+      version = "2.1.1";
+
+      src = fetchurl {
+        url = "http://download.deluge-torrent.org/source/${lib.versions.majorMinor version}/deluge-${version}.tar.xz";
+        hash = "sha256-do3TGYAuQkN6s3lOvnW0lxQuCO1bD7JQO61izvRC3/c=";
+      };
+
+      propagatedBuildInputs = with pypkgs; [
+        twisted
+        mako
+        chardet
+        pyxdg
+        pyopenssl
+        service-identity
+        libtorrent-rasterbar.dev
+        libtorrent-rasterbar.python
+        setuptools
+        setproctitle
+        pillow
+        rencode
+        six
+        zope-interface
+        dbus-python
+        pycairo
+        librsvg
+      ] ++ optionals withGUI [
+        gtk3
+        gobject-introspection
+        pygobject3
+      ];
+
+      nativeBuildInputs = [
+        intltool
+        glib
+      ] ++ optionals withGUI [
+        gobject-introspection
+        wrapGAppsHook
+      ];
+
+      nativeCheckInputs = with pypkgs; [
+        pytestCheckHook
+        pytest-twisted
+        pytest-cov
+        mock
+        mccabe
+        pylint
+      ];
+
+      doCheck = false; # tests are not working at all
+
+      postInstall = ''
+        install -Dm444 -t $out/lib/systemd/system packaging/systemd/*.service
+      '' + (if withGUI
+      then ''
+        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
+      '' else ''
+        rm -r $out/bin/deluge-gtk
+        rm -r $out/${python3Packages.python.sitePackages}/deluge/ui/gtk3
+        rm -r $out/share/{icons,man/man1/deluge-gtk*,pixmaps}
+      '');
+
+      postFixup = ''
+        for f in $out/lib/systemd/system/*; do
+          substituteInPlace $f --replace /usr/bin $out/bin
+        done
+      '';
+
+      meta = with lib; {
+        description = "Torrent client";
+        homepage = "https://deluge-torrent.org";
+        license = licenses.gpl3Plus;
+        maintainers = with maintainers; [ domenkozar ebzzry ];
+        platforms = platforms.all;
+      };
+    };
+
+in
+rec {
+  deluge-gtk = generic { pname = "deluge-gtk"; withGUI = true; };
+  deluged = generic { pname = "deluged"; withGUI = false; };
+  deluge = deluge-gtk;
+}
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..6765c029ffe2
--- /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.27";
+
+  src = fetchFromGitHub {
+    # Use transmission fork from post-0.27-transmission branch
+    owner = "transmission";
+    repo = pname;
+    rev = "015585510e402a057ec17142711ba2b568b5fd62";
+    sha256 = "m4utcxqE3Mn5L4IQ9UfuJXj2KkXXnqKBGqh7kHHGMJQ=";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  meta = with lib; {
+    description = "BitTorrent DHT library";
+    homepage = "https://github.com/transmission/dht";
+    license = licenses.mit;
+    maintainers = with maintainers; [ emilytrau ];
+    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/enhanced-ctorrent/default.nix b/nixpkgs/pkgs/applications/networking/p2p/enhanced-ctorrent/default.nix
new file mode 100644
index 000000000000..b83729ebc693
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/enhanced-ctorrent/default.nix
@@ -0,0 +1,36 @@
+{ lib, stdenv, fetchurl, fetchpatch }:
+
+stdenv.mkDerivation {
+  version = "3.3.2";
+  pname = "enhanced-ctorrent-dhn";
+
+  src = fetchurl {
+    url = "http://www.rahul.net/dholmes/ctorrent/ctorrent-dnh3.3.2.tar.gz";
+    sha256 = "0qs8waqwllk56i3yy3zhncy7nsnhmf09a494p5siz4vm2k4ncwy8";
+  };
+
+  # These patches come from Debian and fix CVE-2009-1759.
+  patches = [
+    (fetchpatch {
+      url = "https://sources.debian.org/data/main/c/ctorrent/1.3.4.dnh3.3.2-5/debian/patches/cve-security-fix.diff";
+      sha256 = "1qkzzm8sfspbcs10azmmif4qcr7pr8r38dsa2py84lsjm1yi3kls";
+    })
+    (fetchpatch {
+      url = "https://sources.debian.org/data/main/c/ctorrent/1.3.4.dnh3.3.2-5/debian/patches/FTBFS-fix.diff";
+      sha256 = "1m3zh96xwqjjzsbg62f7kx0miams58nys1f484qhdn870b5x9p06";
+    })
+  ];
+
+  meta = {
+    broken = stdenv.isDarwin;
+    description = "BitTorrent client written in C++";
+    longDescription = ''
+      CTorrent, a BitTorrent client implemented in C++, with bugfixes and
+      performance enhancements.
+    '';
+    homepage = "http://www.rahul.net/dholmes/ctorrent/";
+    license = lib.licenses.gpl2Plus;
+    platforms = lib.platforms.unix;
+    maintainers = [ lib.maintainers.devhell ];
+  };
+}
diff --git a/nixpkgs/pkgs/applications/networking/p2p/flood-for-transmission/default.nix b/nixpkgs/pkgs/applications/networking/p2p/flood-for-transmission/default.nix
new file mode 100644
index 000000000000..2ffbeba1f40a
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/flood-for-transmission/default.nix
@@ -0,0 +1,37 @@
+# To use this package, use: `services.transmission.webHome = pkgs.flood-for-transmission;`
+{ lib
+, buildNpmPackage
+, fetchFromGitHub
+}:
+
+buildNpmPackage rec {
+  pname = "flood-for-transmission";
+  version = "2024-01-24T16-52-06";
+
+  src = fetchFromGitHub {
+    owner = "johman10";
+    repo = pname;
+    rev = version;
+    hash = "sha256-ZV/Gk9DlYkMh8j034YGvMVN7MeOJgFARyOr9Atrs3j4=";
+  };
+
+  npmDepsHash = "sha256-VHWM0vxFKucrmoJiwYpjw7QqhBQw9rPPQVIIevp6Wn0=";
+
+  npmInstallFlags = [ "--legacy-peer-deps" ];
+
+  installPhase = ''
+    runHook preInstall
+
+    cp -r public $out
+
+    runHook postInstall
+  '';
+
+  meta = with lib; {
+    description = "A Flood clone for Transmission";
+    homepage = "https://github.com/johman10/flood-for-transmission";
+    maintainers = with maintainers; [ al3xtjames ];
+    license = licenses.gpl3Only;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/applications/networking/p2p/flood/default.nix b/nixpkgs/pkgs/applications/networking/p2p/flood/default.nix
new file mode 100644
index 000000000000..8ee94f17e50c
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/flood/default.nix
@@ -0,0 +1,26 @@
+{ lib
+, buildNpmPackage
+, fetchFromGitHub
+}:
+
+buildNpmPackage rec {
+  pname = "flood";
+  version = "unstable-2023-06-03";
+
+  src = fetchFromGitHub {
+    owner = "jesec";
+    repo = pname;
+    rev = "2b652f8148dab7134eeeb201b9d81dd6b8bda074";
+    hash = "sha256-wI6URPGUZUbydSgNaHN2C5IA2x/HHjBWIRT6H6iZU/0=";
+  };
+
+  npmDepsHash = "sha256-XmDnvq+ni5TOf3UQFc4JvGI3LiGpjbrLAocRvrW8qgk=";
+
+  meta = with lib; {
+    description = "Modern web UI for various torrent clients with a Node.js backend and React frontend";
+    homepage = "https://flood.js.org";
+    license = licenses.gpl3Only;
+    maintainers = with maintainers; [ thiagokokada winter ];
+    mainProgram = "flood";
+  };
+}
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..5034f401a98d
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/fragments/default.nix
@@ -0,0 +1,87 @@
+{ lib
+, stdenv
+, fetchFromGitLab
+, fetchpatch
+, appstream-glib
+, cargo
+, dbus
+, desktop-file-utils
+, git
+, glib
+, gtk4
+, libadwaita
+, meson
+, ninja
+, openssl
+, pkg-config
+, rustPlatform
+, rustc
+, sqlite
+, transmission
+, wrapGAppsHook4
+}:
+
+let
+  patchedTransmission = transmission.overrideAttrs (oldAttrs: {
+    patches = (oldAttrs.patches or []) ++ [
+      (fetchpatch {
+        url = "https://raw.githubusercontent.com/flathub/de.haeckerfelix.Fragments/2aee477c8e26a24570f8dbbdbd1c49e017ae32eb/transmission_pdeathsig.patch";
+        sha256 = "sha256-/rCoA566tMmzqcIfffC082Y56TwEyyQJ0knxymtscbA=";
+      })
+    ];
+  });
+in stdenv.mkDerivation rec {
+  pname = "fragments";
+  version = "2.1.1";
+
+  src = fetchFromGitLab {
+    domain = "gitlab.gnome.org";
+    owner = "World";
+    repo = "Fragments";
+    rev = version;
+    sha256 = "sha256-tZcVw4rxmNPcKKgyRB+alEktktZfKK+7FYUVAAGA9bw=";
+  };
+
+  patches = [];
+  cargoDeps = rustPlatform.fetchCargoTarball {
+    inherit src patches;
+    name = "${pname}-${version}";
+    hash = "sha256-nqVaYnL3jKGBsAsakIkgwksjH4yuMhwCQe0zq3jgjnA=";
+  };
+
+  nativeBuildInputs = [
+    appstream-glib
+    desktop-file-utils
+    git
+    meson
+    ninja
+    pkg-config
+    wrapGAppsHook4
+    rustPlatform.cargoSetupHook
+    cargo
+    rustc
+  ];
+
+  buildInputs = [
+    dbus
+    glib
+    gtk4
+    libadwaita
+    openssl
+    sqlite
+  ];
+
+  preFixup =  ''
+    gappsWrapperArgs+=(
+      --prefix PATH : "${lib.makeBinPath [ patchedTransmission ]}"
+    )
+  '';
+
+  meta = with lib; {
+    homepage = "https://gitlab.gnome.org/World/Fragments";
+    description = "Easy to use BitTorrent client for the GNOME desktop environment";
+    maintainers = with maintainers; [ emilytrau ];
+    license = licenses.gpl3Plus;
+    platforms = platforms.linux;
+  };
+}
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..3ca23647251a
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/freenet/default.nix
@@ -0,0 +1,126 @@
+{ lib, stdenv, fetchurl, fetchFromGitHub, jdk, jre, gradle, bash, coreutils
+, substituteAll, nixosTests, perl, fetchpatch, writeText }:
+
+let
+  version = "01497";
+
+  freenet_ext = fetchurl {
+    url = "https://github.com/freenet/fred/releases/download/build01495/freenet-ext.jar";
+    sha256 = "sha256-MvKz1r7t9UE36i+aPr72dmbXafCWawjNF/19tZuk158=";
+  };
+
+  seednodes = fetchurl {
+    url = "https://downloads.freenetproject.org/alpha/opennet/seednodes.fref";
+    sha256 = "08awwr8n80b4cdzzb3y8hf2fzkr1f2ly4nlq779d6pvi5jymqdvv";
+  };
+
+  patches = [
+    # gradle 7 support
+    # https://github.com/freenet/fred/pull/827
+    (fetchpatch {
+      url = "https://github.com/freenet/fred/commit/8991303493f2c0d9933f645337f0a7a5a979e70a.patch";
+      sha256 = "sha256-T1zymxRTADVhhwp2TyB+BC/J4gZsT/CUuMrT4COlpTY=";
+    })
+  ];
+
+in stdenv.mkDerivation rec {
+  pname = "freenet";
+  inherit version patches;
+
+  src = fetchFromGitHub {
+    owner = "freenet";
+    repo = "fred";
+    rev = "refs/tags/build${version}";
+    hash = "sha256-pywNPekofF/QotNVF28McojqK7c1Zzucds5rWV0R7BQ=";
+  };
+
+  postPatch = ''
+    rm gradle/verification-{keyring.keys,metadata.xml}
+  '';
+
+  nativeBuildInputs = [ gradle jdk ];
+
+  wrapper = substituteAll {
+    src = ./freenetWrapper;
+    inherit bash coreutils jre seednodes;
+  };
+
+  # https://github.com/freenet/fred/blob/next/build-offline.sh
+  # fake build to pre-download deps into fixed-output derivation
+  deps = stdenv.mkDerivation {
+    pname = "${pname}-deps";
+    inherit src version patches;
+
+    nativeBuildInputs = [ gradle perl ];
+    buildPhase = ''
+      export GRADLE_USER_HOME=$(mktemp -d)
+      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/caches/modules-2 -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 =~ s/okio-jvm/okio/r)}" #e' \
+        | sh
+    '';
+    # Don't move info to share/
+    forceShare = [ "dummy" ];
+    outputHashMode = "recursive";
+    # Downloaded jars differ by platform
+    outputHash = "sha256-CZf5M3lI7Lz9Pl8U/lNoQ6V6Jxbmkxau8L273XFFS2E=";
+    outputHashAlgo = "sha256";
+  };
+
+  # Point to our local deps repo
+  gradleInit = writeText "init.gradle" ''
+    gradle.projectsLoaded {
+      rootProject.allprojects {
+        buildscript {
+          repositories {
+            clear()
+            maven { url '${deps}/'; metadataSources {mavenPom(); artifact()} }
+          }
+        }
+        repositories {
+          clear()
+          maven { url '${deps}/'; metadataSources {mavenPom(); artifact()} }
+        }
+      }
+    }
+
+    settingsEvaluated { settings ->
+      settings.pluginManagement {
+        repositories {
+          maven { url '${deps}/'; metadataSources {mavenPom(); artifact()} }
+        }
+      }
+    }
+  '';
+
+  buildPhase = ''
+    gradle jar -Dorg.gradle.java.home=${jdk} --offline --no-daemon --info --init-script $gradleInit
+  '';
+
+  installPhase = ''
+    runHook preInstall
+    install -Dm444 build/libs/freenet.jar $out/share/freenet/freenet.jar
+    ln -s ${freenet_ext} $out/share/freenet/freenet-ext.jar
+    mkdir -p $out/bin
+    install -Dm555 ${wrapper} $out/bin/freenet
+    substituteInPlace $out/bin/freenet \
+      --subst-var-by outFreenet $out
+    ln -s ${deps} $out/deps
+    runHook postInstall
+  '';
+
+  passthru.tests = { inherit (nixosTests) freenet; };
+
+  meta = {
+    description = "Decentralised and censorship-resistant network";
+    homepage = "https://freenetproject.org/";
+    sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
+    license = lib.licenses.gpl2Plus;
+    maintainers = with lib.maintainers; [ nagy ];
+    platforms = with lib.platforms; linux;
+    changelog = "https://github.com/freenet/fred/blob/build${version}/NEWS.md";
+  };
+}
diff --git a/nixpkgs/pkgs/applications/networking/p2p/freenet/freenetWrapper b/nixpkgs/pkgs/applications/networking/p2p/freenet/freenetWrapper
new file mode 100755
index 000000000000..74ff2c62961f
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/freenet/freenetWrapper
@@ -0,0 +1,18 @@
+#! @bash@/bin/bash
+set -eo pipefail
+PATH=@coreutils@/bin:$PATH
+export CLASSPATH=$(find @outFreenet@/deps/ -name "*.jar"|grep -v bcprov-jdk15on-1.48.jar|tr $'\n' :)
+CLASSPATH=$CLASSPATH:@outFreenet@/share/freenet/freenet-ext.jar:@outFreenet@/share/freenet/freenet.jar
+
+export FREENET_HOME="$HOME/.local/share/freenet"
+if [ -n "$XDG_DATA_HOME" ] ; then
+  FREENET_HOME="$XDG_DATA_HOME/freenet"
+fi
+
+mkdir -p -- $FREENET_HOME
+
+cp -u -- @seednodes@ $FREENET_HOME/seednodes.fref
+chmod u+rw -- $FREENET_HOME/seednodes.fref
+
+cd -- $FREENET_HOME
+exec @jre@/bin/java -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..9f4261e07c81
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/frostwire/default.nix
@@ -0,0 +1,99 @@
+{ lib, stdenv, fetchFromGitHub, gradle_6, perl, jre, makeWrapper, makeDesktopItem, mplayer }:
+
+let
+  version = "6.6.7-build-529";
+
+  src = fetchFromGitHub {
+    owner = "frostwire";
+    repo = "frostwire";
+    rev = "frostwire-desktop-${version}";
+    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 {
+    pname = "frostwire-desktop-deps";
+    inherit version 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 = "sha256-r6YSrbSJbM3063JrX4tCVKFrJxTaLN4Trc+33jzpwcE=";
+  };
+
+in stdenv.mkDerivation {
+  pname = "frostwire-desktop";
+  inherit version 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";
+    sourceProvenance = with sourceTypes; [
+      fromSource
+      binaryBytecode  # deps
+    ];
+    license = licenses.gpl2;
+    maintainers = with maintainers; [ gavin ];
+    platforms = [ "x86_64-darwin" "x86_64-linux" "i686-linux" ];
+    broken = true; # at 2022-09-30, errors with changing hash.
+  };
+}
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..fd5424cee342
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/frostwire/frostwire-bin.nix
@@ -0,0 +1,46 @@
+{ lib, stdenv, fetchurl, jre, makeWrapper }:
+
+stdenv.mkDerivation rec {
+  version = "6.9.8";
+  pname = "frostwire";
+
+  src = fetchurl {
+    url = "https://dl.frostwire.com/frostwire/${version}/frostwire-${version}.amd64.tar.gz";
+    sha256 = "sha256-gslNdvxA4rGKg0bjf2KWw7w9NMp3zqrii144AfKsV4s=";
+  };
+
+  nativeBuildInputs = [ makeWrapper ];
+
+  installPhase = ''
+    runHook preInstall
+
+    mkdir -p $out/share/java
+    mv $(ls */*.jar) $out/share/java
+
+    makeWrapper $out/share/java/frostwire $out/bin/frostwire \
+      --prefix PATH : ${jre}/bin \
+      --prefix LD_LIBRARY_PATH : $out/share/java \
+      --set JAVA_HOME "${jre}"
+
+    substituteInPlace $out/share/java/frostwire \
+      --replace "export JAVA_PROGRAM_DIR=/usr/lib/frostwire/jre/bin" \
+        "export JAVA_PROGRAM_DIR=${jre}/bin/"
+
+    substituteInPlace $out/share/java/frostwire.desktop \
+      --replace "Exec=/usr/bin/frostwire %U" "Exec=${placeholder "out"}/bin/frostwire %U"
+
+    runHook postInstall
+  '';
+
+  meta = with lib; {
+    homepage = "https://www.frostwire.com/";
+    description = "BitTorrent Client and Cloud File Downloader";
+    sourceProvenance = with sourceTypes; [
+      binaryBytecode
+      binaryNativeCode
+    ];
+    license = licenses.gpl3Plus;
+    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..27476d3b48a7
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/gnunet/default.nix
@@ -0,0 +1,75 @@
+{ 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 ? true, postgresql }:
+
+stdenv.mkDerivation rec {
+  pname = "gnunet";
+  version = "0.20.0";
+
+  src = fetchurl {
+    url = "mirror://gnu/gnunet/${pname}-${version}.tar.gz";
+    sha256 = "sha256-VgKeeKmcBNUrE1gJSuUHTkzY6puYz2hV9XrZryeslRg=";
+  };
+
+  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.unix;
+    changelog = "https://git.gnunet.org/gnunet.git/tree/ChangeLog?h=v${version}";
+  };
+}
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..94504f2b9956
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/gnunet/gtk.nix
@@ -0,0 +1,51 @@
+{ stdenv, fetchurl
+, glade
+, gnunet
+, gnutls
+, gtk3
+, libextractor
+, libgcrypt
+, libsodium
+, libxml2
+, pkg-config
+, wrapGAppsHook
+}:
+
+stdenv.mkDerivation rec {
+  pname = "gnunet-gtk";
+  version = "0.20.0";
+
+  src = fetchurl {
+    url = "mirror://gnu/gnunet/${pname}-${version}.tar.gz";
+    sha256 = "sha256-6ZHlDIKrTmr/aRz4k5FtRVxZ7B9Hlh2w42QT4YRsVi0=";
+  };
+
+  nativeBuildInputs= [
+    pkg-config
+    wrapGAppsHook
+  ];
+
+  buildInputs = [
+    glade
+    gnunet
+    gnutls
+    gtk3
+    libextractor
+    libgcrypt
+    libsodium
+    libxml2
+  ];
+
+  configureFlags = [ "--with-gnunet=${gnunet}" ];
+
+  postPatch = "patchShebangs pixmaps/icon-theme-installer";
+
+  postInstall = ''
+    ln -s $out/share/gnunet-gtk/gnunet_logo.png $out/share/gnunet/gnunet-logo-color.png
+  '';
+
+  meta = gnunet.meta // {
+    description = "GNUnet GTK User Interface";
+    homepage = "https://git.gnunet.org/gnunet-gtk.git";
+  };
+}
diff --git a/nixpkgs/pkgs/applications/networking/p2p/jesec-rtorrent/avoid-stack-overflow-for-lockfile-buf.patch b/nixpkgs/pkgs/applications/networking/p2p/jesec-rtorrent/avoid-stack-overflow-for-lockfile-buf.patch
new file mode 100644
index 000000000000..2a20b157a2fc
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/jesec-rtorrent/avoid-stack-overflow-for-lockfile-buf.patch
@@ -0,0 +1,30 @@
+From dd4a96073d4a60ca8fff55be6ea6b17018de96a8 Mon Sep 17 00:00:00 2001
+From: Varun Madiath <git@madiathv.com>
+Date: Wed, 19 Jul 2023 15:30:57 -0400
+Subject: [PATCH] utils: lockfile: avoid stack overflow for lockfile buffer
+
+Original patch by @cyphar was submitted to rakshasa/rtorrent at
+https://github.com/rakshasa/rtorrent/pull/1169.
+
+Observed the segfault on nixos-unstable.
+---
+ src/utils/lockfile.cc | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/utils/lockfile.cc b/src/utils/lockfile.cc
+index 76e4b8f..441f5c8 100644
+--- a/src/utils/lockfile.cc
++++ b/src/utils/lockfile.cc
+@@ -75,7 +75,8 @@ Lockfile::try_lock() {
+   int  pos = ::gethostname(buf, 255);
+ 
+   if (pos == 0) {
+-    ::snprintf(buf + std::strlen(buf), 255, ":+%i\n", ::getpid());
++    ssize_t len = std::strlen(buf);
++    ::snprintf(buf + len, 255 - len, ":+%i\n", ::getpid());
+     ssize_t __attribute__((unused)) result = ::write(fd, buf, std::strlen(buf));
+   }
+ 
+-- 
+2.41.0
+
diff --git a/nixpkgs/pkgs/applications/networking/p2p/jesec-rtorrent/default.nix b/nixpkgs/pkgs/applications/networking/p2p/jesec-rtorrent/default.nix
new file mode 100644
index 000000000000..94c1994bd080
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/jesec-rtorrent/default.nix
@@ -0,0 +1,74 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+, cmake
+, curl
+, gtest
+, libtorrent
+, ncurses
+, jsonRpcSupport ? true, nlohmann_json
+, xmlRpcSupport ? true, xmlrpc_c
+}:
+
+stdenv.mkDerivation rec {
+  pname = "jesec-rtorrent";
+  version = "0.9.8-r16";
+
+  src = fetchFromGitHub {
+    owner = "jesec";
+    repo = "rtorrent";
+    rev = "v${version}";
+    hash = "sha256-i7c1jSawHshj1kaXl8tdpelIKU24okeg9K5/+ht6t2k=";
+  };
+
+  patches = [
+    ./avoid-stack-overflow-for-lockfile-buf.patch
+  ];
+
+  passthru = {
+    inherit libtorrent;
+  };
+
+  nativeBuildInputs = [
+    cmake
+  ];
+
+  buildInputs = [
+    curl
+    libtorrent
+    ncurses
+  ]
+  ++ lib.optional jsonRpcSupport nlohmann_json
+  ++ lib.optional xmlRpcSupport xmlrpc_c;
+
+  cmakeFlags = [
+    "-DUSE_RUNTIME_CA_DETECTION=NO"
+  ]
+  ++ lib.optional (!jsonRpcSupport) "-DUSE_JSONRPC=NO"
+  ++ lib.optional (!xmlRpcSupport) "-DUSE_XMLRPC=NO";
+
+  doCheck = true;
+
+  nativeCheckInputs = [
+    gtest
+  ];
+
+  prePatch = ''
+    substituteInPlace src/main.cc \
+      --replace "/etc/rtorrent/rtorrent.rc" "${placeholder "out"}/etc/rtorrent/rtorrent.rc"
+  '';
+
+  postFixup = ''
+    mkdir -p $out/etc/rtorrent
+    cp $src/doc/rtorrent.rc $out/etc/rtorrent/rtorrent.rc
+  '';
+
+  meta = with lib; {
+    description = "An ncurses client for libtorrent, ideal for use with screen, tmux, or dtach (jesec's fork)";
+    homepage = "https://github.com/jesec/rtorrent";
+    license = licenses.gpl2Plus;
+    maintainers = with maintainers; [ winter AndersonTorres ];
+    platforms = platforms.linux;
+    mainProgram = "rtorrent";
+  };
+}
diff --git a/nixpkgs/pkgs/applications/networking/p2p/jesec-rtorrent/libtorrent.nix b/nixpkgs/pkgs/applications/networking/p2p/jesec-rtorrent/libtorrent.nix
new file mode 100644
index 000000000000..7acfee3671da
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/jesec-rtorrent/libtorrent.nix
@@ -0,0 +1,48 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+, cmake
+, gtest
+, openssl
+, zlib
+}:
+
+stdenv.mkDerivation rec {
+  pname = "jesec-libtorrent";
+  version = "0.13.8-r4";
+
+  src = fetchFromGitHub {
+    owner = "jesec";
+    repo = "libtorrent";
+    rev = "v${version}";
+    hash = "sha256-jC/hgGSi2qy+ToZgdxl1PhASLYbUL0O8trX0th2v5H0=";
+  };
+
+  nativeBuildInputs = [
+    cmake
+  ];
+
+  buildInputs = [
+    openssl
+    zlib
+  ];
+
+  # Disabled because a test is flaky; see https://github.com/jesec/libtorrent/issues/4.
+  # doCheck = true;
+
+  preCheck = ''
+    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}$PWD
+  '';
+
+  nativeCheckInputs = [
+    gtest
+  ];
+
+  meta = with lib; {
+    homepage = "https://github.com/jesec/libtorrent";
+    description = "A BitTorrent library written in C++ for *nix, with focus on high performance and good code (jesec's fork)";
+    license = licenses.gpl2Plus;
+    maintainers = with maintainers; [ winter AndersonTorres ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/applications/networking/p2p/libutp/3.4.nix b/nixpkgs/pkgs/applications/networking/p2p/libutp/3.4.nix
new file mode 100644
index 000000000000..dfff1eeed239
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/libutp/3.4.nix
@@ -0,0 +1,30 @@
+{ stdenv, lib, fetchFromGitHub, cmake, unstableGitUpdater }:
+
+stdenv.mkDerivation rec {
+  pname = "libutp";
+  version = "unstable-2023-11-14";
+
+  src = fetchFromGitHub {
+    # Use transmission fork from post-3.4-transmission branch
+    owner = "transmission";
+    repo = pname;
+    rev = "52645d6d0fb16009e11d2f84469d2e43b7b6b48a";
+    hash = "sha256-pcPVkDEEtriN9zlEcVFKwKhhh51wpJGxYlcu7bH1RkI=";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  passthru = {
+    updateScript = unstableGitUpdater {
+      branch = "post-3.4-transmission";
+    };
+  };
+
+  meta = with lib; {
+    description = "uTorrent Transport Protocol library";
+    homepage = "https://github.com/transmission/libutp";
+    license = licenses.mit;
+    maintainers = with maintainers; [ emilytrau ];
+    platforms = platforms.unix;
+  };
+}
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..a07ffdea6b69
--- /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; [ emilytrau ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/applications/networking/p2p/lokinet/default.nix b/nixpkgs/pkgs/applications/networking/p2p/lokinet/default.nix
new file mode 100644
index 000000000000..00db925c5dac
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/lokinet/default.nix
@@ -0,0 +1,76 @@
+{ stdenv
+, lib
+, fetchFromGitHub
+, fetchpatch
+, cmake
+, libevent
+, libsodium
+, libuv
+, nlohmann_json
+, pkg-config
+, spdlog
+, fmt_9
+, sqlite
+, systemd
+, unbound
+, zeromq
+}:
+let
+  # Upstream has received reports of incompatibilities with fmt, and other
+  # dependencies, see: https://github.com/oxen-io/lokinet/issues/2200.
+  spdlog' = spdlog.override {
+    fmt = fmt_9;
+  };
+
+in stdenv.mkDerivation rec {
+  pname = "lokinet";
+  version = "0.9.11";
+
+  src = fetchFromGitHub {
+    owner = "oxen-io";
+    repo = "lokinet";
+    rev = "refs/tags/v${version}";
+    fetchSubmodules = true;
+    hash = "sha256-aVFLDGTbRUOw2XWDpl+ojwHBG7c0miGeoKMLwMpqVtg=";
+  };
+
+  patches = [
+    # Fix gcc-13 compatibility:
+    (fetchpatch {
+      name = "gcc-13.patch";
+      url = "https://github.com/oxen-io/lokinet/commit/89c5c73be48788ba14a55cb6d82d57208b487eaf.patch";
+      hash = "sha256-yCy4WXs6p67TMe4uPNAuQyJvtP3IbpJS81AeomNu9lU=";
+    })
+  ];
+
+  nativeBuildInputs = [
+    cmake
+    pkg-config
+  ];
+
+  buildInputs = [
+    libevent
+    libuv
+    libsodium
+    nlohmann_json
+    spdlog'
+    sqlite
+    systemd
+    unbound
+    zeromq
+  ];
+
+  cmakeFlags = [
+    "-DGIT_VERSION=v${version}"
+    "-DWITH_BOOTSTRAP=OFF" # we provide bootstrap files manually
+    "-DWITH_SETCAP=OFF"
+  ];
+
+  meta = with lib; {
+    description = "Anonymous, decentralized and IP based overlay network for the internet";
+    homepage = "https://lokinet.org/";
+    changelog = "https://github.com/oxen-io/lokinet/releases/tag/v${version}";
+    license = licenses.gpl3Plus;
+    maintainers = with maintainers; [ wyndon ];
+  };
+}
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..a51dba890a40
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/magnetico/default.nix
@@ -0,0 +1,45 @@
+{ lib
+, fetchFromGitHub
+, nixosTests
+, buildGoModule
+}:
+
+buildGoModule rec {
+  pname = "magnetico";
+  version = "unstable-2022-08-10";
+
+  src = fetchFromGitHub {
+    owner  = "ireun";
+    repo   = "magnetico";
+    rev    = "828e230d3b3c0759d3274e27f5a7b70400f4d6ea";
+    sha256 = "sha256-V1pBzillWTk9iuHAhFztxYaq4uLL3U3HYvedGk6ffbk=";
+  };
+
+  vendorHash = "sha256-ngYkTtBEZSyYYnfBHi0VrotwKGvMOiowbrwigJnjsuU=";
+
+  buildPhase = ''
+    runHook preBuild
+
+    make magneticow magneticod
+
+    runHook postBuild
+  '';
+
+  checkPhase = ''
+    runHook preBuild
+
+    make test
+
+    runHook postBuild
+  '';
+
+  passthru.tests = { inherit (nixosTests) magnetico; };
+
+  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..81a625e5210f
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/mldonkey/default.nix
@@ -0,0 +1,46 @@
+{ lib, stdenv, fetchurl, fetchpatch, 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";
+  };
+
+  patches = [
+    # Fixes C++17 compat
+    (fetchpatch {
+      url = "https://github.com/ygrek/mldonkey/pull/66/commits/20ff84c185396f3d759cf4ef46b9f0bd33a51060.patch";
+      hash = "sha256-MCqx0jVfOaLkZhhv0b1cTdO6BK2/f6TxTWmx+NZjXME=";
+    })
+    # Fixes OCaml 4.12 compat
+    (fetchpatch {
+      url = "https://github.com/ygrek/mldonkey/commit/a153f0f7a4826d86d51d4bacedc0330b70fcbc34.patch";
+      hash = "sha256-/Muk3mPFjQJ48FqaozGa7o8YSPhDLXRz9K1EyfxlzC8=";
+    })
+    # Fixes OCaml 4.14 compat
+    (fetchpatch {
+      url = "https://github.com/FabioLolix/AUR-artifacts/raw/6721c2d4ef0be9a99499ecf2787e378e50b915e9/mldonkey-fix-build.patch";
+      hash = "sha256-HPW/CKfhywy+Km5/64Iok4tO9LJjAk53jVlsYzIRPfs=";
+    })
+  ];
+
+  preConfigure = ''
+    substituteInPlace Makefile --replace '+camlp4' \
+      '${ocamlPackages.camlp4}/lib/ocaml/${ocamlPackages.ocaml.version}/site-lib/camlp4'
+  '';
+
+  strictDeps = true;
+  nativeBuildInputs = with ocamlPackages; [ ocaml camlp4 ];
+  buildInputs = (with ocamlPackages; [ num ]) ++ [ zlib ];
+
+  meta = {
+    broken = stdenv.isDarwin;
+    description = "Client for many p2p networks, with multiple frontends";
+    homepage = "https://github.com/ygrek/mldonkey";
+    license = lib.licenses.gpl2Only;
+    platforms = lib.platforms.unix;
+  };
+}
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..ebc105147d3d
--- /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-2021-08-23";
+
+  src = fetchgit {
+    url = "https://erdgeist.org/gitweb/opentracker";
+    rev = "110868ec4ebe60521d5a4ced63feca6a1cf0aa2a";
+    sha256 = "sha256-SuElfmk7zONolTiyg0pyvbfvyJRn3r9OrXwpTzLw8LI=";
+  };
+
+  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/pyrosimple/default.nix b/nixpkgs/pkgs/applications/networking/p2p/pyrosimple/default.nix
new file mode 100644
index 000000000000..2f75ce1b29a1
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/pyrosimple/default.nix
@@ -0,0 +1,69 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+, nix-update-script
+, pyrosimple
+, python3
+, testers
+, withInotify ? stdenv.isLinux
+}:
+
+python3.pkgs.buildPythonApplication rec {
+  pname = "pyrosimple";
+  version = "2.12.1";
+  format = "pyproject";
+
+  src = fetchFromGitHub {
+    owner = "kannibalox";
+    repo = pname;
+    rev = "refs/tags/v${version}";
+    hash = "sha256-ppSQknpRoxq35t7lPbqz7MPJzy98yq/GgSchPOx4VT4=";
+  };
+
+  pythonRelaxDeps = [
+    "prometheus-client"
+    "python-daemon"
+  ];
+
+  nativeBuildInputs = with python3.pkgs; [
+    poetry-core
+    pythonRelaxDepsHook
+  ];
+
+  propagatedBuildInputs = with python3.pkgs; [
+    bencode-py
+    apscheduler
+    jinja2
+    python-daemon
+    importlib-resources
+    parsimonious
+    prometheus-client
+    prompt-toolkit
+    requests
+    shtab
+    python-box
+    tomli-w
+  ] ++ lib.optionals (pythonOlder "3.11") [
+    tomli
+  ] ++ lib.optional withInotify inotify;
+
+  nativeCheckInputs = with python3.pkgs; [
+    pytestCheckHook
+  ];
+
+  passthru = {
+    updateScript = nix-update-script { };
+    tests = testers.testVersion {
+      package = pyrosimple;
+      command = "pyroadmin --version";
+    };
+  };
+
+  meta = with lib; {
+    description = "A rTorrent client";
+    homepage = "https://kannibalox.github.io/pyrosimple/";
+    changelog = "https://github.com/kannibalox/pyrosimple/blob/v${version}/CHANGELOG.md";
+    license = licenses.gpl3Plus;
+    maintainers = with maintainers; [ ne9z vamega ];
+  };
+}
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..05006aec3e93
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/qbittorrent/default.nix
@@ -0,0 +1,100 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+
+, boost
+, cmake
+, Cocoa
+, libtorrent-rasterbar
+, ninja
+, qtbase
+, qtsvg
+, qttools
+, wrapGAppsHook
+, wrapQtAppsHook
+
+, guiSupport ? true
+, dbus
+, qtwayland
+
+, trackerSearch ? true
+, python3
+
+, webuiSupport ? true
+}:
+
+let
+  qtVersion = lib.versions.major qtbase.version;
+in
+stdenv.mkDerivation rec {
+  pname = "qbittorrent"
+    + lib.optionalString (guiSupport && qtVersion == "5") "-qt5"
+    + lib.optionalString (!guiSupport) "-nox";
+  version = "4.6.3";
+
+  src = fetchFromGitHub {
+    owner = "qbittorrent";
+    repo = "qBittorrent";
+    rev = "release-${version}";
+    hash = "sha256-4RVJ7xQY9zcB8+RUr80P9xKUXGxt0ATSzYmRDfZIowU=";
+  };
+
+  nativeBuildInputs = [
+    cmake
+    ninja
+    wrapGAppsHook
+    wrapQtAppsHook
+  ];
+
+  buildInputs = [
+    boost
+    libtorrent-rasterbar
+    qtbase
+    qtsvg
+    qttools
+  ] ++ lib.optionals stdenv.isDarwin [
+    Cocoa
+  ] ++ lib.optionals guiSupport [
+    dbus
+  ] ++ lib.optionals (guiSupport && stdenv.isLinux) [
+    qtwayland
+  ] ++ lib.optionals trackerSearch [
+    python3
+  ];
+
+  cmakeFlags = lib.optionals (qtVersion == "6") [
+    "-DQT6=ON"
+  ] ++ lib.optionals (!guiSupport) [
+    "-DGUI=OFF"
+    "-DSYSTEMD=ON"
+    "-DSYSTEMD_SERVICES_INSTALL_DIR=${placeholder "out"}/lib/systemd/system"
+  ] ++ lib.optionals (!webuiSupport) [
+    "-DWEBUI=OFF"
+  ];
+
+  qtWrapperArgs = lib.optionals trackerSearch [
+    "--prefix PATH : ${lib.makeBinPath [ python3 ]}"
+  ];
+
+  dontWrapGApps = true;
+
+  postInstall = lib.optionalString stdenv.isDarwin ''
+    APP_NAME=qbittorrent${lib.optionalString (!guiSupport) "-nox"}
+    mkdir -p $out/{Applications,bin}
+    cp -R $APP_NAME.app $out/Applications
+    makeWrapper $out/{Applications/$APP_NAME.app/Contents/MacOS,bin}/$APP_NAME
+  '';
+
+  preFixup = ''
+    qtWrapperArgs+=("''${gappsWrapperArgs[@]}")
+  '';
+
+  meta = with lib; {
+    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.unix;
+    maintainers = with maintainers; [ Anton-Latukha kashw2 ];
+  };
+}
diff --git a/nixpkgs/pkgs/applications/networking/p2p/rakshasa-rtorrent/default.nix b/nixpkgs/pkgs/applications/networking/p2p/rakshasa-rtorrent/default.nix
new file mode 100644
index 000000000000..c454c3ad2053
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/rakshasa-rtorrent/default.nix
@@ -0,0 +1,73 @@
+{ lib
+, stdenv
+, fetchurl
+, fetchFromGitHub
+, autoreconfHook
+, autoconf-archive
+, cppunit
+, curl
+, libsigcxx
+, libtool
+, libtorrent
+, ncurses
+, openssl
+, pkg-config
+, xmlrpc_c
+, zlib
+}:
+
+stdenv.mkDerivation rec {
+  pname = "rakshasa-rtorrent";
+  version = "0.9.8+date=2022-06-20";
+
+  src = fetchFromGitHub {
+    owner = "rakshasa";
+    repo = "rtorrent";
+    rev = "92bec88d0904bfb31c808085c2fd0f22d0ec8db7";
+    hash = "sha256-er7UdIb+flhq0ye76UmomgfHV2ZSBROpXmfrNDHwTWw=";
+  };
+
+  passthru = {
+    inherit libtorrent;
+  };
+
+  nativeBuildInputs = [
+    autoconf-archive
+    autoreconfHook
+    pkg-config
+  ];
+
+  buildInputs = [
+    cppunit
+    curl
+    libsigcxx
+    libtool
+    libtorrent
+    ncurses
+    openssl
+    xmlrpc_c
+    zlib
+  ];
+
+  configureFlags = [
+    "--with-xmlrpc-c"
+    "--with-posix-fallocate"
+  ];
+
+  enableParallelBuilding = true;
+
+  postInstall = ''
+    mkdir -p $out/share/man/man1 $out/share/doc/rtorrent
+    mv doc/old/rtorrent.1 $out/share/man/man1/rtorrent.1
+    mv doc/rtorrent.rc $out/share/doc/rtorrent/rtorrent.rc
+  '';
+
+  meta = with lib; {
+    homepage = "https://rakshasa.github.io/rtorrent/";
+    description = "An ncurses client for libtorrent, ideal for use with screen, tmux, or dtach";
+    license = licenses.gpl2Plus;
+    maintainers = with maintainers; [ ebzzry codyopel ];
+    platforms = platforms.unix;
+    mainProgram = "rtorrent";
+  };
+}
diff --git a/nixpkgs/pkgs/applications/networking/p2p/rakshasa-rtorrent/libtorrent.nix b/nixpkgs/pkgs/applications/networking/p2p/rakshasa-rtorrent/libtorrent.nix
new file mode 100644
index 000000000000..fff4cbb36cf6
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/rakshasa-rtorrent/libtorrent.nix
@@ -0,0 +1,48 @@
+# Note: this is rakshasa's version of libtorrent, used mainly by rtorrent.
+# *Do not* mistake it by libtorrent-rasterbar, used by Deluge, qbitttorent etc.
+{ lib
+, stdenv
+, fetchFromGitHub
+, autoconf-archive
+, autoreconfHook
+, cppunit
+, libsigcxx
+, openssl
+, pkg-config
+, zlib
+}:
+
+stdenv.mkDerivation rec {
+  pname = "rakshasa-libtorrent";
+  version = "0.13.8+date=2021-08-07";
+
+  src = fetchFromGitHub {
+    owner = "rakshasa";
+    repo = "libtorrent";
+    rev = "53596afc5fae275b3fb5753a4bb2a1a7f7cf6a51";
+    hash = "sha256-gyl/jfbptHz/gHkkVGWShhv1Z7o9fa9nJIz27U2A6wg=";
+  };
+
+  nativeBuildInputs = [
+    autoconf-archive
+    autoreconfHook
+    pkg-config
+  ];
+
+  buildInputs = [
+    cppunit
+    libsigcxx
+    openssl
+    zlib
+  ];
+
+  enableParallelBuilding = true;
+
+  meta = with lib; {
+    homepage = "https://github.com/rakshasa/libtorrent";
+    description = "A BitTorrent library written in C++ for *nix, with focus on high performance and good code";
+    license = licenses.gpl2Plus;
+    maintainers = with maintainers; [ ebzzry codyopel ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/applications/networking/p2p/retroshare/cpp-filesystem.patch b/nixpkgs/pkgs/applications/networking/p2p/retroshare/cpp-filesystem.patch
new file mode 100644
index 000000000000..e9aa64e2871a
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/retroshare/cpp-filesystem.patch
@@ -0,0 +1,12 @@
+diff --git a/libretroshare/src/util/rsdir.cc b/libretroshare/src/util/rsdir.cc
+index 8556b8198..d63699216 100644
+--- a/libretroshare/src/util/rsdir.cc
++++ b/libretroshare/src/util/rsdir.cc
+@@ -47,6 +47,7 @@
+ 
+ #include <fstream>
+ #include <stdexcept>
++#include <filesystem>
+ 
+ #if defined(WIN32) || defined(__CYGWIN__)
+ #include "util/rsstring.h"
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..1f4edd2e49dc
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/retroshare/default.nix
@@ -0,0 +1,63 @@
+{ lib, mkDerivation, fetchFromGitHub
+, fetchpatch
+, 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
+    ./cpp-filesystem.patch
+
+    # Fix gcc-13 build failure
+    (fetchpatch {
+      name = "gcc-13.patch";
+      url = "https://github.com/RetroShare/RetroShare/commit/e1934fd9b03cd52c556eb06d94fb5d68b649592e.patch";
+      hash = "sha256-oqxQAsD4fmkWAH2kSVmmed/q0LzTW/iqUU1SgYNdFyk=";
+    })
+  ];
+
+  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..9587bd0a9304
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/soulseekqt/default.nix
@@ -0,0 +1,57 @@
+{ 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 = ''
+      binary="$(realpath ${appextracted}/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 ${appextracted}/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="$(realpath ${appextracted}/.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/$(basename $icon)
+      done
+    '';
+
+  meta = with lib; {
+    description = "Official Qt SoulSeek client";
+    homepage = "https://www.slsknet.org";
+    mainProgram = "SoulseekQt";
+    sourceProvenance = with sourceTypes; [ binaryNativeCode ];
+    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..2119e80a93f4
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/stig/default.nix
@@ -0,0 +1,67 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+, python310Packages
+, testers
+, stig
+}:
+
+python310Packages.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.12.8a0";
+
+  src = fetchFromGitHub {
+    owner = "rndusr";
+    repo = "stig";
+    rev = "v${version}";
+    sha256 = "sha256-vfmuA6DqWvAygcS6N+qX1h+Ag+P4eOwm41DhAFZR3r8=";
+  };
+
+  propagatedBuildInputs = with python310Packages; [
+    urwid
+    urwidtrees
+    aiohttp
+    async-timeout
+    pyxdg
+    blinker
+    natsort
+    setproctitle
+  ];
+
+  nativeCheckInputs = with python310Packages; [
+    asynctest
+    pytestCheckHook
+  ];
+
+  dontUseSetuptoolsCheck = true;
+
+  preCheck = ''
+    export LC_ALL=C
+  '';
+
+  disabledTestPaths = [
+    # Almost all tests fail in this file, it is reported upstream in:
+    # https://github.com/rndusr/stig/issues/214 , and upstream fails to
+    # reproduce the issue unfortunately.
+    "tests/client_test/aiotransmission_test/api_settings_test.py"
+  ];
+  disabledTests = [
+    # Another failure with similar circumstances to the above
+    "test_candidates_are_sorted_case_insensitively"
+  ];
+
+  passthru.tests = testers.testVersion {
+    package = stig;
+    command = "stig -v";
+    version = "stig version ${version}";
+  };
+
+  meta = with lib; {
+    description = "TUI and CLI for the BitTorrent client Transmission";
+    homepage = "https://github.com/rndusr/stig";
+    license = licenses.gpl3Plus;
+    maintainers = with maintainers; [ doronbehar ];
+  };
+}
diff --git a/nixpkgs/pkgs/applications/networking/p2p/storrent/default.nix b/nixpkgs/pkgs/applications/networking/p2p/storrent/default.nix
new file mode 100644
index 000000000000..a21a9fef3855
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/storrent/default.nix
@@ -0,0 +1,25 @@
+{ lib, buildGoModule, fetchFromGitHub }:
+
+buildGoModule rec {
+  pname = "storrent";
+  version = "unstable-2023-01-14";
+
+  src = fetchFromGitHub {
+    owner = "jech";
+    repo = "storrent";
+    rev = "86270ee777a19a521f8898a179485e0347f90ce0";
+    hash = "sha256-JYNtuyk4hhe1jZgY/5Bz91Ropdw/U7n1VKHYkdUjZ0I=";
+  };
+
+  vendorHash = "sha256-iPKZPXsa6ya29N/u9QYd5LAm42+FtHZLGStRDxsAxe4=";
+
+  ldflags = [ "-s" "-w" ];
+
+  meta = with lib; {
+    homepage = "https://github.com/jech/storrent";
+    description = "An implementation of the BitTorrent protocol that is optimised for streaming media";
+    license = licenses.mit;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.marsam ];
+  };
+}
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..9ab60d5a18f4
--- /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 = "unstable-2023-02-16";
+
+  src = fetchFromGitHub {
+    owner = "Luminarys";
+    repo = "synapse";
+    rev = "2165fe22589d7255e497d196c1d42b4c2ace1408";
+    hash = "sha256-2irXNgEK9BjRuNu3DUMElmf2vIpGzwoFneAEe97GRh4=";
+  };
+
+  cargoHash = "sha256-TwXouPYM7Hg1HEr2KnEPScYFkC52PcQ5kb5aGP1gj9U=";
+
+  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/torrential/default.nix b/nixpkgs/pkgs/applications/networking/p2p/torrential/default.nix
new file mode 100644
index 000000000000..cfc10c3f7466
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/torrential/default.nix
@@ -0,0 +1,84 @@
+{ stdenv
+, lib
+, fetchFromGitHub
+, nix-update-script
+, desktop-file-utils
+, meson
+, ninja
+, pkg-config
+, python3
+, vala
+, wrapGAppsHook4
+, curl
+, dht
+, glib
+, gtk4
+, libb64
+, libevent
+, libgee
+, libnatpmp
+, libtransmission
+, libutp
+, miniupnpc
+, openssl
+, pantheon
+}:
+
+stdenv.mkDerivation rec {
+  pname = "torrential";
+  version = "3.0.0";
+
+  src = fetchFromGitHub {
+    owner = "davidmhewitt";
+    repo = "torrential";
+    rev = version;
+    sha256 = "sha256-uHc/VNtbhetmGyuhynZH1TvxJscVX17eWO6dzX6Ft3A=";
+  };
+
+  nativeBuildInputs = [
+    desktop-file-utils
+    meson
+    ninja
+    pkg-config
+    python3
+    vala
+    wrapGAppsHook4
+  ];
+
+  buildInputs = [
+    curl
+    dht
+    glib
+    gtk4
+    libb64
+    libevent
+    libgee
+    libnatpmp
+    libtransmission
+    libutp
+    miniupnpc
+    openssl
+    pantheon.granite7
+  ];
+
+  postPatch = ''
+    chmod +x meson/post_install.py
+    patchShebangs meson/post_install.py
+
+    substituteInPlace meson/post_install.py \
+      --replace "gtk-update-icon-cache" "gtk4-update-icon-cache"
+  '';
+
+  passthru = {
+    updateScript = nix-update-script { };
+  };
+
+  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;
+    mainProgram = "com.github.davidmhewitt.torrential";
+  };
+}
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..4f3f711d1f2c
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/transgui/default.nix
@@ -0,0 +1,73 @@
+{ lib, stdenv, fetchFromGitHub, pkg-config, makeDesktopItem, fetchpatch, unzip
+, fpc, lazarus, libX11, glib, gtk2, gdk-pixbuf, pango, atk, cairo, openssl
+, unstableGitUpdater }:
+
+stdenv.mkDerivation rec {
+  pname = "transgui";
+  version = "unstable-2023-10-19";
+
+  src = fetchFromGitHub {
+    owner = "transmission-remote-gui";
+    repo = "transgui";
+    rev = "b1f5c2334edb6659c04863ef4a534ba1e57284f0";
+    hash = "sha256-XCokcA5lINC9B+qwg0vjkymwa16ZNHRKLI829+X7CvE=";
+  };
+
+  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
+  '';
+
+  postPatch = ''
+    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 {
+    name = pname;
+    exec = "${pname} %U";
+    icon = pname;
+    type = "Application";
+    comment = meta.description;
+    desktopName = "Transmission Remote GUI";
+    genericName = "BitTorrent Client";
+    categories = [ "Network" "FileTransfer" "P2P" "GTK" ];
+    startupNotify = true;
+    mimeTypes = [ "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"
+  '';
+
+  passthru.updateScript = unstableGitUpdater { };
+
+  meta = {
+    description = "A cross platform front-end for the Transmission BitTorrent client";
+    homepage = "https://sourceforge.net/p/transgui";
+    license = lib.licenses.gpl2Plus;
+    maintainers = with lib.maintainers; [ ramkromberg ];
+    mainProgram = "transgui";
+    platforms = [ "x86_64-linux" "x86_64-darwin" ];
+  };
+}
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..28b425a05e3b
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/transmission-remote-gtk/default.nix
@@ -0,0 +1,68 @@
+{ lib
+, stdenv
+, appstream-glib
+, curl
+, desktop-file-utils
+, fetchFromGitHub
+, geoip
+, gettext
+, glib
+, glib-networking
+, gtk3
+, json-glib
+, libappindicator
+, libmrss
+, libproxy
+, libsoup_3
+, meson
+, ninja
+, pkg-config
+, wrapGAppsHook
+}:
+
+stdenv.mkDerivation rec {
+  pname = "transmission-remote-gtk";
+  version = "1.6.0";
+
+  src = fetchFromGitHub {
+    owner = "transmission-remote-gtk";
+    repo = "transmission-remote-gtk";
+    rev = "refs/tags/${version}";
+    hash = "sha256-/syZI/5LhuYLvXrNknnpbGHEH0z5iHeye2YRNJFWZJ0=";
+  };
+
+  nativeBuildInputs = [
+    appstream-glib
+    desktop-file-utils
+    meson
+    ninja
+    pkg-config
+    wrapGAppsHook
+  ];
+
+  buildInputs = [
+    curl
+    geoip
+    gettext
+    glib
+    gtk3
+    json-glib
+    libappindicator
+    libmrss
+    libproxy
+    libsoup_3
+    # For TLS support.
+    glib-networking
+  ];
+
+  doCheck = false; # Requires network access
+
+  meta = with lib; {
+    description = "GTK remote control for the Transmission BitTorrent client";
+    homepage = "https://github.com/transmission-remote-gtk/transmission-remote-gtk";
+    changelog = "https://github.com/transmission-remote-gtk/transmission-remote-gtk/releases/tag/${version}";
+    license = licenses.gpl2;
+    maintainers = with maintainers; [ ehmry ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/applications/networking/p2p/transmission/4.nix b/nixpkgs/pkgs/applications/networking/p2p/transmission/4.nix
new file mode 100644
index 000000000000..9e0a1d69ef21
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/transmission/4.nix
@@ -0,0 +1,169 @@
+{ stdenv
+, lib
+, fetchFromGitHub
+, cmake
+, pkg-config
+, python3
+, openssl
+, curl
+, libevent
+, inotify-tools
+, systemd
+, zlib
+, pcre
+, libb64
+, libutp
+, libdeflate
+, utf8cpp
+, fmt
+, libpsl
+, miniupnpc
+, dht
+, libnatpmp
+, libiconv
+, Foundation
+  # Build options
+, enableGTK3 ? false
+, gtkmm3
+, xorg
+, wrapGAppsHook
+, enableQt ? false
+, qt5
+, nixosTests
+, enableSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd
+, enableDaemon ? true
+, enableCli ? true
+, installLib ? false
+, apparmorRulesFromClosure
+}:
+
+stdenv.mkDerivation (finalAttrs: {
+  pname = "transmission";
+  version = "4.0.5";
+
+  src = fetchFromGitHub {
+    owner = "transmission";
+    repo = "transmission";
+    rev = finalAttrs.version;
+    hash = "sha256-gd1LGAhMuSyC/19wxkoE2mqVozjGPfupIPGojKY0Hn4=";
+    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}"
+    ] ++ lib.optionals stdenv.isDarwin [
+      # Transmission sets this to 10.13 if not explicitly specified, see https://github.com/transmission/transmission/blob/0be7091eb12f4eb55f6690f313ef70a66795ee72/CMakeLists.txt#L7-L16.
+      "-DCMAKE_OSX_DEPLOYMENT_TARGET=${stdenv.hostPlatform.darwinMinVersion}"
+    ];
+
+  postPatch = ''
+    # Clean third-party libraries to ensure system ones are used.
+    # Excluding gtest since it is hardcoded to vendored version. The rest of the listed libraries are not packaged.
+    pushd third-party
+    for f in *; do
+        if [[ ! $f =~ googletest|wildmat|fast_float|wide-integer|jsonsl ]]; then
+            rm -r "$f"
+        fi
+    done
+    popd
+    rm \
+      cmake/FindFmt.cmake \
+      cmake/FindUtfCpp.cmake
+    # Upstream uses different config file name.
+    substituteInPlace CMakeLists.txt --replace 'find_package(UtfCpp)' 'find_package(utf8cpp)'
+  '';
+
+  nativeBuildInputs = [
+    pkg-config
+    cmake
+    python3
+  ]
+  ++ lib.optionals enableGTK3 [ wrapGAppsHook ]
+  ++ lib.optionals enableQt [ qt5.wrapQtAppsHook ]
+  ;
+
+  buildInputs = [
+    curl
+    dht
+    fmt
+    libb64
+    libdeflate
+    libevent
+    libnatpmp
+    libpsl
+    libutp
+    miniupnpc
+    openssl
+    pcre
+    utf8cpp
+    zlib
+  ]
+  ++ lib.optionals enableQt [ qt5.qttools qt5.qtbase ]
+  ++ lib.optionals enableGTK3 [ gtkmm3 xorg.libpthreadstubs ]
+  ++ lib.optionals enableSystemd [ systemd ]
+  ++ lib.optionals stdenv.isLinux [ inotify-tools ]
+  ++ lib.optionals stdenv.isDarwin [ libiconv Foundation ];
+
+  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 libdeflate libpsl 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 $out/share/transmission/public_html/**,
+
+      include <local/bin.transmission-daemon>
+    }
+    EOF
+    install -Dm0444 -t $out/share/icons ../qt/icons/transmission.svg
+  '';
+
+  passthru.tests = {
+    apparmor = nixosTests.transmission_4; # starts the service with apparmor enabled
+    smoke-test = nixosTests.bittorrent;
+  };
+
+  meta = {
+    description = "A fast, easy and free BitTorrent client";
+    mainProgram = if enableQt then "transmission-qt" else if enableGTK3 then "transmission-gtk" else "transmission-cli";
+    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 = with lib.licenses; [ gpl2Plus mit ];
+    maintainers = with lib.maintainers; [ astsmtl ];
+    platforms = lib.platforms.unix;
+  };
+})
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..58de6fa9754f
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/transmission/default.nix
@@ -0,0 +1,147 @@
+{ stdenv
+, lib
+, fetchFromGitHub
+, fetchurl
+, cmake
+, pkg-config
+, openssl
+, curl
+, libevent
+, inotify-tools
+, systemd
+, zlib
+, pcre
+, libb64
+, libutp
+, miniupnpc
+, dht
+, libnatpmp
+, libiconv
+  # Build options
+, enableGTK3 ? false
+, gtk3
+, xorg
+, wrapGAppsHook
+, enableQt ? false
+, qt5
+, nixosTests
+, enableSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd
+, enableDaemon ? true
+, enableCli ? true
+, installLib ? false
+, apparmorRulesFromClosure
+}:
+
+stdenv.mkDerivation (finalAttrs: {
+  pname = "transmission";
+  version = "3.00";
+
+  src = fetchFromGitHub {
+    owner = "transmission";
+    repo = "transmission";
+    rev = finalAttrs.version;
+    sha256 = "0ccg0km54f700x9p0jsnncnwvfnxfnxf7kcm7pcx1cj0vw78924z";
+    fetchSubmodules = true;
+  };
+
+  patches = [
+    # fix build with openssl 3.0
+    (fetchurl {
+      url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/net-p2p/transmission/files/transmission-3.00-openssl-3.patch";
+      hash = "sha256-peVrkGck8AfbC9uYNfv1CIu1alIewpca7A6kRXjVlVs=";
+    })
+  ];
+
+  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 ]
+  ++ lib.optionals stdenv.isDarwin [ libiconv ];
+
+  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 $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";
+    mainProgram = if enableQt then "transmission-qt" else if enableGTK3 then "transmission-gtk" else "transmission-cli";
+    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 ];
+    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..48e6a76c29a5
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/tremc/default.nix
@@ -0,0 +1,61 @@
+{ 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.3";
+  format = "other";
+
+  src = fetchFromGitHub {
+    owner = "tremc";
+    repo = pname;
+    rev = version;
+    hash = "sha256-219rntmetmj1JFG+4NyYMFTWmrHKJL7fnLoMIvnTP4Y=";
+  };
+
+  patches = [
+    # Remove when tremc > 0.9.3 is released
+    (fetchpatch {
+      url = "https://github.com/tremc/tremc/commit/a8aaf9a6728a9ef3d8f13b3603456b0086122891.patch";
+      hash = "sha256-+HYdWTbcpvZqjshdHLZ+Svmr6U/aKFc3sy0aka6rn/A=";
+      name = "support-transmission-4.patch";
+    })
+  ];
+
+  buildInputs = with python3Packages; [
+    python
+    wrapPython
+  ];
+
+  pythonPath = with python3Packages; [
+    ipy
+    pyperclip
+  ] ++
+  lib.optional useGeoIP geoip;
+
+  dontBuild = true;
+  doCheck = false;
+
+  makeWrapperArgs = ["--prefix PATH : ${lib.escapeShellArg wrapperPath}"];
+
+  installPhase = ''
+    make DESTDIR=$out install
+    wrapPythonPrograms
+  '';
+
+  meta = with lib; {
+    description = "Curses interface for transmission";
+    homepage = "https://github.com/tremc/tremc";
+    license = licenses.gpl3Plus;
+    maintainers = with maintainers; [ kashw2 ];
+  };
+}
diff --git a/nixpkgs/pkgs/applications/networking/p2p/tremotesf/default.nix b/nixpkgs/pkgs/applications/networking/p2p/tremotesf/default.nix
new file mode 100644
index 000000000000..df898599701b
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/tremotesf/default.nix
@@ -0,0 +1,52 @@
+{stdenv
+,lib
+, cmake
+, pkg-config
+, fetchFromGitHub
+, qtbase
+, qttools
+, kwidgetsaddons
+, kwindowsystem
+, fmt
+, libpsl
+, cxxopts
+, wrapQtAppsHook
+}:
+
+stdenv.mkDerivation (finalAttrs: {
+  pname = "tremotesf";
+  version = "2.6.0";
+
+  src = fetchFromGitHub {
+    owner = "equeim";
+    repo = "tremotesf2";
+    rev = finalAttrs.version;
+    hash = "sha256-9iV4UsKZWaIxhqtRZXTFHgjOKVFJE2bCJOD2O/qL+DY=";
+    # We need this for src/libtremotesf
+    fetchSubmodules = true;
+  };
+
+  buildInputs = [
+    qtbase
+    qttools
+    fmt
+    libpsl
+    kwidgetsaddons
+    kwindowsystem
+    cxxopts
+  ];
+
+  nativeBuildInputs = [
+    cmake
+    pkg-config
+  ];
+
+  propagatedBuildInputs = [ wrapQtAppsHook ];
+
+  meta = with lib; {
+    description = "Remote GUI for transmission-daemon";
+    license = licenses.gpl3Plus;
+    homepage = "https://github.com/equeim/tremotesf2";
+    maintainers = with maintainers; [ sochotnicky ];
+  };
+})
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..e5949d2b11aa
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/tribler/default.nix
@@ -0,0 +1,116 @@
+{ lib
+, stdenv
+, fetchurl
+, fetchPypi
+, python3
+, makeWrapper
+, libtorrent-rasterbar-1_2_x
+, qt5
+}:
+
+let
+  libtorrent = (python3.pkgs.toPythonModule (libtorrent-rasterbar-1_2_x)).python;
+in
+stdenv.mkDerivation rec {
+  pname = "tribler";
+  version = "7.13.0";
+
+  src = fetchurl {
+    url = "https://github.com/Tribler/tribler/releases/download/v${version}/Tribler-${version}.tar.xz";
+    hash = "sha256-j9+Kq6dOqiJCTY3vuRWGnciuwACU7L0pl73l6nkDLN4=";
+  };
+
+  nativeBuildInputs = [
+    python3.pkgs.wrapPython
+    makeWrapper
+    # we had a "copy" of this in tribler's makeWrapper
+    # but it went out of date and broke, so please just use it directly
+    qt5.wrapQtAppsHook
+  ];
+
+  buildInputs = [
+    python3.pkgs.python
+  ];
+
+  pythonPath = [
+    libtorrent
+  ] ++ (with python3.pkgs; [
+    # requirements-core.txt
+    aiohttp
+    aiohttp-apispec
+    anyio
+    chardet
+    configobj
+    cryptography
+    decorator
+    faker
+    libnacl
+    lz4
+    marshmallow
+    netifaces
+    networkx
+    pony
+    psutil
+    pyasn1
+    pydantic_1
+    pyopenssl
+    pyyaml
+    sentry-sdk
+    service-identity
+    yappi
+    yarl
+    bitarray
+    (pyipv8.overrideAttrs (p: rec {
+      version = "2.10.0";
+      src = fetchPypi {
+        inherit (p) pname;
+        inherit version;
+        hash = "sha256-yxiXBxBiPokequm+vjsHIoG9kQnRnbsOx3mYOd8nmiU=";
+      };
+    }))
+    libtorrent
+    file-read-backwards
+    brotli
+    human-readable
+    # requirements.txt
+    pillow
+    pyqt5
+    #pyqt5-sip
+    pyqtgraph
+    pyqtwebengine
+  ]);
+
+  installPhase = ''
+    mkdir -pv $out
+    # Nasty hack; call wrapPythonPrograms to set program_PYTHONPATH.
+    wrapPythonPrograms
+    cp -prvd ./* $out/
+    makeWrapper ${python3.pkgs.python}/bin/python $out/bin/tribler \
+        --set _TRIBLERPATH "$out/src" \
+        --set PYTHONPATH $out/src/tribler-core:$out/src/tribler-common:$out/src/tribler-gui:$program_PYTHONPATH \
+        --set NO_AT_BRIDGE 1 \
+        --chdir "$out/src" \
+        --add-flags "-O $out/src/run_tribler.py"
+
+    mkdir -p $out/share/applications $out/share/icons
+    cp $out/build/debian/tribler/usr/share/applications/org.tribler.Tribler.desktop $out/share/applications/
+    cp $out/build/debian/tribler/usr/share/pixmaps/tribler_big.xpm $out/share/icons/tribler.xpm
+    mkdir -p $out/share/copyright/tribler
+    mv $out/LICENSE $out/share/copyright/tribler
+  '';
+
+  shellHook = ''
+    wrapPythonPrograms || true
+    export QT_QPA_PLATFORM_PLUGIN_PATH=$(echo ${qt5.qtbase.bin}/lib/qt-*/plugins/platforms)
+    export PYTHONPATH=./tribler-core:./tribler-common:./tribler-gui:$program_PYTHONPATH
+    export QT_PLUGIN_PATH="${qt5.qtsvg.bin}/${qt5.qtbase.qtPluginPrefix}"
+  '';
+
+  meta = with lib; {
+    description = "Decentralised P2P filesharing client based on the Bittorrent protocol";
+    homepage = "https://www.tribler.org/";
+    license = licenses.lgpl21Plus;
+    maintainers = with maintainers; [ xvapx viric mkg20001 ];
+    platforms = 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..6dc00cba9ee0
--- /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; [ ];
+  };
+}
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..8283a2ec4bee
--- /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.4";
+
+  src = fetchFromGitHub {
+    owner = "majestrate";
+    repo = "XD";
+    rev = "v${version}";
+    sha256 = "sha256-YUstYGIED6ivt+p+aHIK76dLCj+xjytWnZrra49cCi8=";
+  };
+
+  vendorHash = "sha256-wO+IICtGVHhrPa1JUwlx+PuNS32FJNKYmboLd3lFl4w=";
+
+  nativeCheckInputs = [ 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-conservancy/default.nix b/nixpkgs/pkgs/applications/networking/p2p/zeronet-conservancy/default.nix
new file mode 100644
index 000000000000..df91e40eab82
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/zeronet-conservancy/default.nix
@@ -0,0 +1,60 @@
+{ lib
+, fetchFromGitHub
+, python3Packages
+, nixosTests
+}:
+
+python3Packages.buildPythonApplication rec {
+  pname = "zeronet-conservancy";
+  version = "0.7.10";
+  format = "other";
+
+  src = fetchFromGitHub {
+    owner = "zeronet-conservancy";
+    repo = "zeronet-conservancy";
+    rev = "v${version}";
+    sha256 = "sha256-ZQYdK0B0z0cXTx7ujFngW3wSa/j8sEuwHB+BC5Xqq8o=";
+  };
+
+  propagatedBuildInputs = with python3Packages; [
+    gevent msgpack base58 merkletools rsa pysocks pyasn1 websocket-client
+    gevent-websocket rencode bitcoinlib maxminddb pyopenssl rich defusedxml
+    pyaes coincurve
+  ];
+
+  buildPhase = ''
+    runHook preBuild
+    ${python3Packages.python.pythonOnBuildForHost.interpreter} -O -m compileall .
+    runHook postBuild
+  '';
+
+  installPhase = ''
+    runHook preInstall
+    mkdir -p $out/share
+    cp -r plugins src *.py $out/share/
+    runHook postInstall
+  '';
+
+  postFixup = ''
+    makeWrapper "$out/share/zeronet.py" "$out/bin/zeronet" \
+      --set PYTHONPATH "$PYTHONPATH" \
+      --set PATH ${python3Packages.python}/bin
+  '';
+
+  passthru.tests = {
+    nixos-test = nixosTests.zeronet-conservancy;
+  };
+
+  meta = with lib; {
+    description = "A fork/continuation of the ZeroNet project";
+    longDescription = ''
+      zeronet-conservancy is a fork/continuation of ZeroNet project (that has
+      been abandoned by its creator) that is dedicated to sustaining existing
+      p2p network and developing its values of decentralization and freedom,
+      while gradually switching to a better designed network.
+    '';
+    homepage = "https://github.com/zeronet-conservancy/zeronet-conservancy";
+    license = licenses.gpl3Only;
+    maintainers = with maintainers; [ fgaz ];
+  };
+}
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..d0a358a5ba15
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/p2p/zeronet/default.nix
@@ -0,0 +1,45 @@
+{ 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.pythonOnBuildForHost.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 ];
+    knownVulnerabilities = [ ''
+      Unmaintained. Probable XSS/code injection vulnerability.
+      Switching to the maintained zeronet-conservancy package is recommended
+    '' ];
+  };
+}