push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,127 @@
{
lib,
fetchurl,
intltool,
libtorrent-rasterbar,
python3Packages,
gtk3,
glib,
gobject-introspection,
librsvg,
wrapGAppsHook3,
nixosTests,
}:
let
inherit (lib) optionals;
pypkgs = python3Packages;
generic =
{ pname, withGUI }:
pypkgs.buildPythonPackage rec {
inherit pname;
version = "2.2.0";
format = "setuptools";
src = fetchurl {
url = "http://download.deluge-torrent.org/source/${lib.versions.majorMinor version}/deluge-${version}.tar.xz";
hash = "sha256-ubonK1ukKq8caU5sKWKKuBbMGnAKN7rAiqy1JXFgas0=";
};
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
wrapGAppsHook3
];
nativeCheckInputs = with pypkgs; [
pytestCheckHook
pytest-twisted
pytest-cov-stub
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
'';
passthru.tests = { inherit (nixosTests) deluge; };
meta = with lib; {
description = "Torrent client";
homepage = "https://deluge-torrent.org";
license = licenses.gpl3Plus;
maintainers = with maintainers; [
ebzzry
];
platforms = platforms.all;
};
};
in
rec {
deluge-gtk = generic {
pname = "deluge-gtk";
withGUI = true;
};
deluged = generic {
pname = "deluged";
withGUI = false;
};
deluge = deluge-gtk;
}

View File

@@ -0,0 +1,97 @@
{
lib,
stdenv,
fetchFromGitHub,
fetchpatch2,
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=";
};
patches = [
(fetchpatch2 {
url = "https://github.com/eiskaltdcpp/eiskaltdcpp/commit/5ab5e1137a46864b6ecd1ca302756da8b833f754.patch?full_index=1";
hash = "sha256-GIdcIHKXNSbHxbiMGRPgfq2w/zNSfR/FhyyXayFWfg8=";
})
];
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.hostPlatform.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 = "Cross-platform program that uses the Direct Connect and ADC protocols";
homepage = "https://github.com/eiskaltdcpp/eiskaltdcpp";
license = licenses.gpl3Plus;
platforms = platforms.linux;
};
}

View File

@@ -0,0 +1,53 @@
{
lib,
stdenv,
fetchurl,
jre,
makeWrapper,
}:
stdenv.mkDerivation rec {
version = "6.13.3";
pname = "frostwire";
src = fetchurl {
url = "https://github.com/frostwire/frostwire/releases/download/frostwire-desktop-${version}-build-322/frostwire-${version}.amd64.tar.gz";
hash = "sha256-wRT8Oo+niOFBpEnq3pgjO9jpagZMgSE44V9RBYnGwig=";
};
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";
mainProgram = "frostwire";
sourceProvenance = with sourceTypes; [
binaryBytecode
binaryNativeCode
];
license = licenses.gpl3Plus;
maintainers = with maintainers; [ gavin ];
platforms = [ "x86_64-linux" ];
};
}

View File

@@ -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

View File

@@ -0,0 +1,77 @@
{
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 = "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 ];
platforms = platforms.linux;
mainProgram = "rtorrent";
};
}

View File

@@ -0,0 +1,49 @@
{
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 = "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 ];
platforms = platforms.linux;
};
}

View File

@@ -0,0 +1,37 @@
{
stdenv,
lib,
fetchFromGitHub,
cmake,
unstableGitUpdater,
}:
stdenv.mkDerivation {
pname = "libutp";
version = "0-unstable-2024-11-16";
src = fetchFromGitHub {
# Use transmission fork from post-3.4-transmission branch
owner = "transmission";
repo = "libutp";
rev = "490874c44a2ecf914404b0a20e043c9755fff47b";
hash = "sha256-ArUOr392s/rIplthSmHYXnqhO6i1PkkGV1jmQPQL7Yg=";
};
nativeBuildInputs = [ cmake ];
passthru = {
updateScript = unstableGitUpdater {
branch = "post-3.4-transmission";
};
};
meta = with lib; {
description = "uTorrent Transport Protocol library";
mainProgram = "ucat";
homepage = "https://github.com/transmission/libutp";
license = licenses.mit;
maintainers = with maintainers; [ emilytrau ];
platforms = platforms.unix;
};
}

View File

@@ -0,0 +1,29 @@
{
stdenv,
lib,
fetchFromGitHub,
cmake,
}:
stdenv.mkDerivation {
pname = "libutp";
version = "unstable-2017-01-02";
src = fetchFromGitHub {
# Use transmission fork from post-3.3-transmission branch
owner = "transmission";
repo = "libutp";
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;
};
}

View File

@@ -0,0 +1,73 @@
{
lib,
stdenv,
fetchFromGitHub,
autoreconfHook,
autoconf-archive,
ocamlPackages,
pkg-config,
zlib,
}:
stdenv.mkDerivation rec {
pname = "mldonkey";
version = "3.2.1";
src = fetchFromGitHub {
owner = "ygrek";
repo = "mldonkey";
tag = "release-${lib.replaceStrings [ "." ] [ "-" ] version}";
hash = "sha256-Dbb7163CdqHY7/FJY2yWBFRudT+hTFT6fO4sFgt6C/A=";
};
patches = [
./gettext-0.25.patch
];
postPatch = ''
substituteInPlace config/Makefile.in \
--replace-fail '+camlp4' '${ocamlPackages.camlp4}/lib/ocaml/${ocamlPackages.ocaml.version}/site-lib/camlp4'
'';
strictDeps = true;
nativeBuildInputs = [
autoreconfHook
autoconf-archive
ocamlPackages.camlp4
ocamlPackages.findlib
ocamlPackages.ocaml
pkg-config
];
buildInputs = [
ocamlPackages.num
zlib
];
preAutoreconf = ''
cd config
'';
postAutoreconf = ''
cd ..
'';
env = {
NIX_CFLAGS_COMPILE = "-Wno-error=implicit-function-declaration";
}
# https://github.com/ygrek/mldonkey/issues/117
// lib.optionalAttrs stdenv.cc.isClang {
CXXFLAGS = "-std=c++98";
}
// lib.optionalAttrs stdenv.hostPlatform.isDarwin {
NIX_LDFLAGS = "-liconv";
};
meta = {
description = "Client for many p2p networks, with multiple frontends";
homepage = "https://github.com/ygrek/mldonkey";
license = lib.licenses.gpl2Only;
platforms = lib.platforms.unix;
};
}

View File

@@ -0,0 +1,14 @@
diff --git a/config/configure.in b/config/configure.in
index f2dd838b..e1b5ed47 100644
--- a/config/configure.in
+++ b/config/configure.in
@@ -10,6 +10,9 @@ AC_CONFIG_SRCDIR([Makefile.config.in])
AC_CONFIG_HEADER(config.h)
AC_CONFIG_MACRO_DIR([m4])
+AM_GNU_GETTEXT_VERSION([0.25])
+AM_GNU_GETTEXT([external])
+
CONFIGURE_RUN=yes
CONFIGURE_ARGUMENTS=$ac_configure_args
echo "Arguments to configure: $CONFIGURE_ARGUMENTS"

View File

@@ -0,0 +1,103 @@
{
lib,
mkDerivation,
fetchFromGitHub,
fetchpatch2,
qmake,
cmake,
pkg-config,
miniupnpc,
bzip2,
speex,
libmicrohttpd,
libxml2,
libxslt,
sqlcipher,
rapidjson,
libXScrnSaver,
qtbase,
qtx11extras,
qtmultimedia,
libgnome-keyring,
}:
mkDerivation rec {
pname = "retroshare";
version = "0.6.7.2";
src = fetchFromGitHub {
owner = "RetroShare";
repo = "RetroShare";
rev = "v${version}";
hash = "sha256-1A1YvOWIiWlP1JPUTg5Z/lxVGCBv4tCPf5sZdPogitU=";
fetchSubmodules = true;
};
patches = [
# The build normally tries to get git sub-modules during build
# but we already have them checked out
./no-submodules.patch
# Support the miniupnpc-2.2.8 API change
(fetchpatch2 {
url = "https://github.com/RetroShare/libretroshare/commit/f1b89c4f87d77714571b4135c301bf0429096a20.patch?full_index=1";
hash = "sha256-UiZMsUFaOZTLj/dx1rLr5bTR1CQ6nt2+IygQdvwJqwc=";
stripLen = 1;
extraPrefix = "libretroshare/";
})
];
nativeBuildInputs = [
pkg-config
qmake
cmake
];
buildInputs = [
speex
miniupnpc
qtmultimedia
qtx11extras
qtbase
libgnome-keyring
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="
];
postPatch = ''
# Build libsam3 as C, not C++. No, I have no idea why it tries to
# do that, either.
substituteInPlace libretroshare/src/libretroshare.pro \
--replace-fail \
"LIBSAM3_MAKE_PARAMS =" \
"LIBSAM3_MAKE_PARAMS = CC=$CC AR=$AR"
'';
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 ];
};
}

View File

@@ -0,0 +1,81 @@
Submodule libretroshare contains modified content
diff --git a/libretroshare/src/libretroshare.pro b/libretroshare/src/libretroshare.pro
index 923f878c..ef00f3d7 100644
--- a/libretroshare/src/libretroshare.pro
+++ b/libretroshare/src/libretroshare.pro
@@ -930,20 +930,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 += \
@@ -1063,14 +1057,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}) && \
@@ -1106,15 +1095,13 @@ rs_sam3_libsam3 {
win32-g++:isEmpty(QMAKE_SH) {
LIBSAM3_MAKE_PARAMS = CC=gcc
libsam3.commands = \
- cd /D $$shell_path($${RS_SRC_PATH}) && git submodule update --init supportlibs/libsam3 || cd . $$escape_expand(\\n\\t) \
+ cd /D $$shell_path($${RS_SRC_PATH}) && cd . $$escape_expand(\\n\\t) \
$(CHK_DIR_EXISTS) $$shell_path($$LIBSAM3_BUILD_PATH) $(MKDIR) $$shell_path($${LIBSAM3_BUILD_PATH}) $$escape_expand(\\n\\t) \
$(COPY_DIR) $$shell_path($${LIBSAM3_SRC_PATH}) $$shell_path($${LIBSAM3_BUILD_PATH}) || cd . $$escape_expand(\\n\\t)
} else {
LIBSAM3_MAKE_PARAMS =
libsam3.commands = \
- cd $${RS_SRC_PATH} && ( \
- git submodule update --init supportlibs/libsam3 || \
- true ) && \
+ cd $${RS_SRC_PATH} && \
mkdir -p $${LIBSAM3_BUILD_PATH} && \
(cp -r $${LIBSAM3_SRC_PATH}/* $${LIBSAM3_BUILD_PATH} || true) &&
}
diff --git a/retroshare-gui/src/retroshare-gui.pro b/retroshare-gui/src/retroshare-gui.pro
index d73117b84..b2fc6799a 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 \

View File

@@ -0,0 +1,230 @@
{
stdenv,
lib,
fetchFromGitHub,
fetchpatch2,
cmake,
pkg-config,
python3,
openssl,
curl,
libevent,
inotify-tools,
systemd,
zlib,
pcre,
libb64,
libutp,
libdeflate,
utf8cpp,
fmt,
libpsl,
miniupnpc,
dht,
libnatpmp,
libiconv,
# Build options
enableGTK3 ? false,
gtkmm3,
xorg,
wrapGAppsHook3,
enableQt5 ? false,
enableQt6 ? false,
qt5,
qt6Packages,
nixosTests,
enableSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd,
enableDaemon ? true,
enableCli ? true,
installLib ? false,
apparmorRulesFromClosure,
}:
let
inherit (lib) cmakeBool optionals;
apparmorRules = apparmorRulesFromClosure { name = "transmission-daemon"; } (
[
curl
libdeflate
libevent
libnatpmp
libpsl
miniupnpc
openssl
pcre
zlib
]
++ optionals enableSystemd [ systemd ]
++ optionals stdenv.hostPlatform.isLinux [ inotify-tools ]
);
in
stdenv.mkDerivation (finalAttrs: {
pname = "transmission";
version = "4.0.6";
src = fetchFromGitHub {
owner = "transmission";
repo = "transmission";
rev = finalAttrs.version;
hash = "sha256-KBXvBFgrJ3njIoXrxHbHHLsiocwfd7Eba/GNI8uZA38=";
fetchSubmodules = true;
};
patches = [
(fetchpatch2 {
url = "https://github.com/transmission/transmission/commit/febfe49ca3ecab1a7142ecb34012c1f0b2bcdee8.patch?full_index=1";
hash = "sha256-Ge0+AXf/ilfMieGBAdvvImY7JOb0gGIdeKprC37AROs=";
excludes = [
# The submodule that we don't use (we use our miniupnp)
"third-party/miniupnp"
# Hunk fails for this one, but we don't care because we don't rely upon
# xcode definitions even for the Darwin build.
"Transmission.xcodeproj/project.pbxproj"
];
})
];
outputs = [
"out"
"apparmor"
];
cmakeFlags = [
(cmakeBool "ENABLE_CLI" enableCli)
(cmakeBool "ENABLE_DAEMON" enableDaemon)
(cmakeBool "ENABLE_GTK" enableGTK3)
(cmakeBool "ENABLE_MAC" false) # requires xcodebuild
(cmakeBool "ENABLE_QT" (enableQt5 || enableQt6))
(cmakeBool "INSTALL_LIB" installLib)
]
++ optionals stdenv.hostPlatform.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)'
# Use gettext even on Darwin
substituteInPlace libtransmission/utils.h \
--replace-fail '#if defined(HAVE_GETTEXT) && !defined(__APPLE__)' '#if defined(HAVE_GETTEXT)'
'';
nativeBuildInputs = [
pkg-config
cmake
python3
]
++ optionals enableGTK3 [ wrapGAppsHook3 ]
++ optionals enableQt5 [ qt5.wrapQtAppsHook ]
++ optionals enableQt6 [ qt6Packages.wrapQtAppsHook ];
buildInputs = [
curl
dht
fmt
libb64
libdeflate
libevent
libnatpmp
libpsl
libutp
miniupnpc
openssl
pcre
utf8cpp
zlib
]
++ optionals enableQt5 (
with qt5;
[
qttools
qtbase
]
)
++ optionals enableQt6 (
with qt6Packages;
[
qttools
qtbase
qtsvg
]
)
++ optionals enableGTK3 [
gtkmm3
xorg.libpthreadstubs
]
++ optionals enableSystemd [ systemd ]
++ optionals stdenv.hostPlatform.isLinux [ inotify-tools ];
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 "${apparmorRules}"
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 = with lib; {
description = "Fast, easy and free BitTorrent client";
mainProgram =
if (enableQt5 || enableQt6) 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 = "https://www.transmissionbt.com/";
license = with licenses; [
gpl2Plus
mit
];
platforms = platforms.unix;
};
})