2020-05-23 18:46:17 +01:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
2021-01-19 06:50:56 +00:00
|
|
|
, pkg-config
|
2020-05-23 18:46:17 +01:00
|
|
|
, openssl
|
|
|
|
, curl
|
|
|
|
, libevent
|
|
|
|
, inotify-tools
|
|
|
|
, systemd
|
|
|
|
, zlib
|
|
|
|
, pcre
|
2021-08-14 13:35:44 +01:00
|
|
|
, libb64
|
|
|
|
, libutp
|
|
|
|
, miniupnpc
|
|
|
|
, dht
|
|
|
|
, libnatpmp
|
2020-05-23 18:46:17 +01:00
|
|
|
# Build options
|
|
|
|
, enableGTK3 ? false
|
2021-03-16 21:00:50 +00:00
|
|
|
, gtk3
|
2020-05-23 18:46:17 +01:00
|
|
|
, xorg
|
|
|
|
, wrapGAppsHook
|
|
|
|
, enableQt ? false
|
|
|
|
, qt5
|
2021-04-03 23:29:44 +01:00
|
|
|
, nixosTests
|
2017-01-05 23:24:08 +00:00
|
|
|
, enableSystemd ? stdenv.isLinux
|
2017-01-05 23:27:16 +00:00
|
|
|
, enableDaemon ? true
|
2017-01-05 23:26:51 +00:00
|
|
|
, enableCli ? true
|
2021-04-17 11:12:09 +01:00
|
|
|
, installLib ? false
|
2020-12-03 17:03:32 +00:00
|
|
|
, apparmorRulesFromClosure
|
2013-10-04 19:31:02 +01:00
|
|
|
}:
|
2013-03-17 21:27:55 +00:00
|
|
|
|
2020-05-23 18:46:17 +01:00
|
|
|
let
|
|
|
|
version = "3.00";
|
2010-05-20 14:39:16 +01:00
|
|
|
|
2020-05-23 18:46:17 +01:00
|
|
|
in stdenv.mkDerivation {
|
|
|
|
pname = "transmission";
|
|
|
|
inherit version;
|
2012-06-18 16:18:45 +01:00
|
|
|
|
2020-05-23 18:46:17 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "transmission";
|
|
|
|
repo = "transmission";
|
|
|
|
rev = version;
|
|
|
|
sha256 = "0ccg0km54f700x9p0jsnncnwvfnxfnxf7kcm7pcx1cj0vw78924z";
|
|
|
|
fetchSubmodules = true;
|
2010-03-28 00:06:30 +00:00
|
|
|
};
|
2012-06-18 16:18:45 +01:00
|
|
|
|
2020-12-03 17:03:32 +00:00
|
|
|
outputs = [ "out" "apparmor" ];
|
|
|
|
|
2020-05-23 18:46:17 +01:00
|
|
|
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}"
|
2021-04-17 11:12:09 +01:00
|
|
|
"-DINSTALL_LIB=${mkFlag installLib}"
|
2020-05-23 18:46:17 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2021-01-19 06:50:56 +00:00
|
|
|
pkg-config
|
2020-05-23 18:46:17 +01:00
|
|
|
cmake
|
|
|
|
]
|
|
|
|
++ lib.optionals enableGTK3 [ wrapGAppsHook ]
|
|
|
|
++ lib.optionals enableQt [ qt5.wrapQtAppsHook ]
|
|
|
|
;
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
openssl
|
|
|
|
curl
|
|
|
|
libevent
|
|
|
|
zlib
|
|
|
|
pcre
|
2021-08-14 13:35:44 +01:00
|
|
|
libb64
|
|
|
|
libutp
|
|
|
|
miniupnpc
|
|
|
|
dht
|
|
|
|
libnatpmp
|
2020-05-23 18:46:17 +01:00
|
|
|
]
|
|
|
|
++ lib.optionals enableQt [ qt5.qttools qt5.qtbase ]
|
2021-03-16 21:00:50 +00:00
|
|
|
++ lib.optionals enableGTK3 [ gtk3 xorg.libpthreadstubs ]
|
2020-05-23 18:46:17 +01:00
|
|
|
++ lib.optionals enableSystemd [ systemd ]
|
|
|
|
++ lib.optionals stdenv.isLinux [ inotify-tools ]
|
|
|
|
;
|
|
|
|
|
|
|
|
NIX_LDFLAGS = lib.optionalString stdenv.isDarwin "-framework CoreFoundation";
|
|
|
|
|
2020-12-03 17:03:32 +00:00
|
|
|
postInstall = ''
|
2021-05-14 16:19:37 +01:00
|
|
|
mkdir $apparmor
|
|
|
|
cat >$apparmor/bin.transmission-daemon <<EOF
|
2020-12-03 17:03:32 +00:00
|
|
|
include <tunables/global>
|
|
|
|
$out/bin/transmission-daemon {
|
|
|
|
include <abstractions/base>
|
|
|
|
include <abstractions/nameservice>
|
|
|
|
include <abstractions/ssl_certs>
|
|
|
|
include "${apparmorRulesFromClosure { name = "transmission-daemon"; } ([
|
2021-09-27 16:28:35 +01:00
|
|
|
curl libevent openssl pcre zlib libnatpmp miniupnpc
|
2020-12-03 17:03:32 +00:00
|
|
|
] ++ 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_*,
|
|
|
|
|
2021-05-23 18:31:21 +01:00
|
|
|
r $out/share/transmission/web/**,
|
|
|
|
|
2020-12-03 17:03:32 +00:00
|
|
|
include <local/bin.transmission-daemon>
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
'';
|
|
|
|
|
2021-04-03 23:29:44 +01:00
|
|
|
passthru.tests = {
|
2021-09-27 16:28:35 +01:00
|
|
|
apparmor = nixosTests.transmission; # starts the service with apparmor enabled
|
2021-04-03 23:29:44 +01:00
|
|
|
smoke-test = nixosTests.bittorrent;
|
|
|
|
};
|
|
|
|
|
2020-05-23 18:46:17 +01:00
|
|
|
meta = {
|
2010-05-20 14:39:16 +01:00
|
|
|
description = "A fast, easy and free BitTorrent client";
|
2010-03-28 00:06:30 +00:00
|
|
|
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
|
2019-09-03 23:49:40 +01:00
|
|
|
* Native Mac, GTK and Qt GUI clients
|
2010-03-28 00:06:30 +00:00
|
|
|
* 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
|
|
|
|
'';
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "http://www.transmissionbt.com/";
|
2021-08-14 13:35:44 +01:00
|
|
|
license = lib.licenses.gpl2Plus; # parts are under MIT
|
2020-05-23 18:46:17 +01:00
|
|
|
maintainers = with lib.maintainers; [ astsmtl vcunat wizeman ];
|
|
|
|
platforms = lib.platforms.unix;
|
2010-03-28 00:06:30 +00:00
|
|
|
};
|
2013-10-04 19:31:02 +01:00
|
|
|
|
2020-05-23 18:46:17 +01:00
|
|
|
}
|