diff options
author | Peter Hoeg <peter@hoeg.com> | 2024-03-04 11:39:02 +0100 |
---|---|---|
committer | Peter Hoeg <peter@hoeg.com> | 2024-03-07 01:48:21 -0800 |
commit | f0a2f90384c1d67125c91d2bed900d8e7a19a971 (patch) | |
tree | 214acfe366471022352d70aebe3b765824be1437 /pkgs/applications/networking | |
parent | c3acc4173e84367a403aef0723e4064f9649d557 (diff) |
transmission_4-qt: support for qt6
Diffstat (limited to 'pkgs/applications/networking')
-rw-r--r-- | pkgs/applications/networking/p2p/transmission/4.nix | 82 |
1 files changed, 48 insertions, 34 deletions
diff --git a/pkgs/applications/networking/p2p/transmission/4.nix b/pkgs/applications/networking/p2p/transmission/4.nix index 9e0a1d69ef215..75515ef414b0e 100644 --- a/pkgs/applications/networking/p2p/transmission/4.nix +++ b/pkgs/applications/networking/p2p/transmission/4.nix @@ -27,8 +27,10 @@ , gtkmm3 , xorg , wrapGAppsHook -, enableQt ? false +, enableQt5 ? false +, enableQt6 ? false , qt5 +, qt6Packages , nixosTests , enableSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd , enableDaemon ? true @@ -37,6 +39,24 @@ , 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.isLinux [ inotify-tools ]); + +in stdenv.mkDerivation (finalAttrs: { pname = "transmission"; version = "4.0.5"; @@ -51,21 +71,17 @@ stdenv.mkDerivation (finalAttrs: { 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}" - ]; + 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.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. @@ -89,8 +105,9 @@ stdenv.mkDerivation (finalAttrs: { cmake python3 ] - ++ lib.optionals enableGTK3 [ wrapGAppsHook ] - ++ lib.optionals enableQt [ qt5.wrapQtAppsHook ] + ++ optionals enableGTK3 [ wrapGAppsHook ] + ++ optionals enableQt5 [ qt5.wrapQtAppsHook ] + ++ optionals enableQt6 [ qt6Packages.wrapQtAppsHook ] ; buildInputs = [ @@ -109,11 +126,12 @@ stdenv.mkDerivation (finalAttrs: { 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 ]; + ++ optionals enableQt5 (with qt5; [ qttools qtbase ]) + ++ optionals enableQt6 (with qt6Packages; [ qttools qtbase qtsvg ]) + ++ optionals enableGTK3 [ gtkmm3 xorg.libpthreadstubs ] + ++ optionals enableSystemd [ systemd ] + ++ optionals stdenv.isLinux [ inotify-tools ] + ++ optionals stdenv.isDarwin [ libiconv Foundation ]; postInstall = '' mkdir $apparmor @@ -123,11 +141,7 @@ stdenv.mkDerivation (finalAttrs: { 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 ] - )}" + include "${apparmorRules}" r @{PROC}/sys/kernel/random/uuid, r @{PROC}/sys/vm/overcommit_memory, r @{PROC}/@{pid}/environ, @@ -147,9 +161,9 @@ stdenv.mkDerivation (finalAttrs: { smoke-test = nixosTests.bittorrent; }; - meta = { + meta = with lib; { description = "A fast, easy and free BitTorrent client"; - mainProgram = if enableQt then "transmission-qt" else if enableGTK3 then "transmission-gtk" else "transmission-cli"; + 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. @@ -161,9 +175,9 @@ stdenv.mkDerivation (finalAttrs: { * 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; + homepage = "https://www.transmissionbt.com/"; + license = with licenses; [ gpl2Plus mit ]; + maintainers = with maintainers; [ astsmtl ]; + platforms = platforms.unix; }; }) |