diff --git a/pkgs/applications/networking/p2p/transmission/4.nix b/pkgs/applications/networking/p2p/transmission/4.nix index 9e0a1d69ef21..75515ef414b0 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 include include - 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; }; }) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index d15ee2a30578..87916f7f9666 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -35562,7 +35562,9 @@ with pkgs; enableCli = false; }; transmission_4-gtk = transmission_4.override { enableGTK3 = true; }; - transmission_4-qt = transmission_4.override { enableQt = true; }; + transmission_4-qt5 = transmission_4.override { enableQt5 = true; }; + transmission_4-qt6 = transmission_4.override { enableQt6 = true; }; + transmission_4-qt = transmission_4-qt5; transmission-remote-gtk = callPackage ../applications/networking/p2p/transmission-remote-gtk { };