From f649041da99bac2b7c5097f719f52df98c46e4c8 Mon Sep 17 00:00:00 2001 From: KSJ2000 Date: Sun, 24 Nov 2024 12:52:48 +0200 Subject: [PATCH] qbittorrent: modernize derivation --- .../networking/p2p/qbittorrent/default.nix | 76 +++++++++---------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/pkgs/applications/networking/p2p/qbittorrent/default.nix b/pkgs/applications/networking/p2p/qbittorrent/default.nix index 052b5ec0a64a..09cd980538ec 100644 --- a/pkgs/applications/networking/p2p/qbittorrent/default.nix +++ b/pkgs/applications/networking/p2p/qbittorrent/default.nix @@ -1,65 +1,60 @@ { - lib, - stdenv, - fetchFromGitHub, - + apple-sdk_11, boost, cmake, - Cocoa, - libtorrent-rasterbar, - ninja, - qtbase, - qtsvg, - qttools, - wrapGAppsHook3, - wrapQtAppsHook, - - guiSupport ? true, dbus, - qtwayland, - - trackerSearch ? true, + fetchFromGitHub, + guiSupport ? true, + lib, + libtorrent-rasterbar, + nix-update-script, + openssl, + pkg-config, python3, - + qt6, + stdenv, + trackerSearch ? true, webuiSupport ? true, + wrapGAppsHook3, + zlib, }: -let - qtVersion = lib.versions.major qtbase.version; -in -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "qbittorrent" + lib.optionalString (!guiSupport) "-nox"; version = "5.0.2"; src = fetchFromGitHub { owner = "qbittorrent"; repo = "qBittorrent"; - rev = "release-${version}"; + rev = "release-${finalAttrs.version}"; hash = "sha256-JIURzAkVNYjHAx8yY0WaKNK4N/z9ndqjk0EXkJH9AzY="; }; nativeBuildInputs = [ cmake - ninja + pkg-config wrapGAppsHook3 - wrapQtAppsHook + qt6.wrapQtAppsHook ]; buildInputs = [ boost libtorrent-rasterbar - qtbase - qtsvg - qttools + openssl + qt6.qtbase + qt6.qtsvg + qt6.qttools + zlib ] - ++ lib.optionals stdenv.hostPlatform.isDarwin [ Cocoa ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ apple-sdk_11 ] ++ lib.optionals guiSupport [ dbus ] - ++ lib.optionals (guiSupport && stdenv.hostPlatform.isLinux) [ qtwayland ] + ++ lib.optionals (guiSupport && stdenv.hostPlatform.isLinux) [ qt6.qtwayland ] ++ lib.optionals trackerSearch [ python3 ]; cmakeFlags = - lib.optionals (!guiSupport) [ + [ "-DVERBOSE_CONFIGURE=ON" ] + ++ lib.optionals (!guiSupport) [ "-DGUI=OFF" "-DSYSTEMD=ON" "-DSYSTEMD_SERVICES_INSTALL_DIR=${placeholder "out"}/lib/systemd/system" @@ -73,7 +68,7 @@ stdenv.mkDerivation rec { postInstall = lib.optionalString stdenv.hostPlatform.isDarwin '' APP_NAME=qbittorrent${lib.optionalString (!guiSupport) "-nox"} mkdir -p $out/{Applications,bin} - cp -R $APP_NAME.app $out/Applications + mv $out/$APP_NAME.app $out/Applications makeWrapper $out/{Applications/$APP_NAME.app/Contents/MacOS,bin}/$APP_NAME ''; @@ -81,16 +76,21 @@ stdenv.mkDerivation rec { qtWrapperArgs+=("''${gappsWrapperArgs[@]}") ''; - meta = with lib; { + passthru.updateScript = nix-update-script { extraArgs = [ "--version-regex=release-(.*)" ]; }; + + meta = { description = "Featureful free software BitTorrent client"; homepage = "https://www.qbittorrent.org"; - changelog = "https://github.com/qbittorrent/qBittorrent/blob/release-${version}/Changelog"; - license = licenses.gpl2Plus; - platforms = platforms.unix; - maintainers = with maintainers; [ + changelog = "https://github.com/qbittorrent/qBittorrent/blob/release-${finalAttrs.version}/Changelog"; + license = with lib.licenses; [ + gpl2Only + gpl3Only + ]; + platforms = lib.platforms.unix; + maintainers = with lib.maintainers; [ Anton-Latukha kashw2 ]; mainProgram = "qbittorrent" + lib.optionalString (!guiSupport) "-nox"; }; -} +})