27 , enableSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd
31 , apparmorRulesFromClosure
34 stdenv.mkDerivation (finalAttrs: {
35 pname = "transmission";
38 src = fetchFromGitHub {
39 owner = "transmission";
40 repo = "transmission";
41 rev = finalAttrs.version;
42 hash = "sha256-n4iEDt9AstDZPZXN47p13brNLbNWS3BTB+A4UuoEjzE=";
43 fetchSubmodules = true;
47 # fix build with openssl 3.0
48 ./transmission-3.00-openssl-3.patch
49 # fix build with miniupnpc 2.2.8
50 ./transmission-3.00-miniupnpc-2.2.8.patch
53 outputs = [ "out" "apparmor" ];
57 mkFlag = opt: if opt then "ON" else "OFF";
60 "-DENABLE_MAC=OFF" # requires xcodebuild
61 "-DENABLE_GTK=${mkFlag enableGTK3}"
62 "-DENABLE_QT=${mkFlag enableQt}"
63 "-DENABLE_DAEMON=${mkFlag enableDaemon}"
64 "-DENABLE_CLI=${mkFlag enableCli}"
65 "-DINSTALL_LIB=${mkFlag installLib}"
72 ++ lib.optionals enableGTK3 [ wrapGAppsHook3 ]
73 ++ lib.optionals enableQt [ qt5.wrapQtAppsHook ]
88 ++ lib.optionals enableQt [ qt5.qttools qt5.qtbase ]
89 ++ lib.optionals enableGTK3 [ gtk3 xorg.libpthreadstubs ]
90 ++ lib.optionals enableSystemd [ systemd ]
91 ++ lib.optionals stdenv.hostPlatform.isLinux [ inotify-tools ]
92 ++ lib.optionals stdenv.hostPlatform.isDarwin [ libiconv ];
96 cat >$apparmor/bin.transmission-daemon <<EOF
97 include <tunables/global>
98 $out/bin/transmission-daemon {
99 include <abstractions/base>
100 include <abstractions/nameservice>
101 include <abstractions/ssl_certs>
102 include "${apparmorRulesFromClosure { name = "transmission-daemon"; } ([
103 curl libevent openssl pcre zlib libnatpmp miniupnpc
104 ] ++ lib.optionals enableSystemd [ systemd ]
105 ++ lib.optionals stdenv.hostPlatform.isLinux [ inotify-tools ]
107 r @{PROC}/sys/kernel/random/uuid,
108 r @{PROC}/sys/vm/overcommit_memory,
109 r @{PROC}/@{pid}/environ,
110 r @{PROC}/@{pid}/mounts,
111 rwk /tmp/tr_session_id_*,
113 r $out/share/transmission/web/**,
115 include <local/bin.transmission-daemon>
121 apparmor = nixosTests.transmission_3; # starts the service with apparmor enabled
122 smoke-test = nixosTests.bittorrent;
126 description = "Fast, easy and free BitTorrent client (deprecated version 3)";
127 mainProgram = if enableQt then "transmission-qt" else if enableGTK3 then "transmission-gtk" else "transmission-cli";
129 Transmission is a BitTorrent client which features a simple interface
130 on top of a cross-platform back-end.
132 * Uses fewer resources than other clients
133 * Native Mac, GTK and Qt GUI clients
134 * Daemon ideal for servers, embedded systems, and headless use
135 * All these can be remote controlled by Web and Terminal clients
136 * Bluetack (PeerGuardian) blocklists with automatic updates
137 * Full encryption, DHT, and PEX support
139 homepage = "http://www.transmissionbt.com/";
140 license = lib.licenses.gpl2Plus; # parts are under MIT
141 maintainers = with lib.maintainers; [ astsmtl ];
142 platforms = lib.platforms.unix;