biome: 1.9.2 -> 1.9.3
[NixPkgs.git] / pkgs / applications / networking / p2p / qbittorrent / default.nix
blobe6cd3a31adf5e6415bafc1957ec41466e896f24e
1 { lib
2 , stdenv
3 , fetchFromGitHub
5 , boost
6 , cmake
7 , Cocoa
8 , libtorrent-rasterbar
9 , ninja
10 , qtbase
11 , qtsvg
12 , qttools
13 , wrapGAppsHook3
14 , wrapQtAppsHook
16 , guiSupport ? true
17 , dbus
18 , qtwayland
20 , trackerSearch ? true
21 , python3
23 , webuiSupport ? true
26 let
27   qtVersion = lib.versions.major qtbase.version;
29 stdenv.mkDerivation rec {
30   pname = "qbittorrent"
31     + lib.optionalString (!guiSupport) "-nox";
32   version = "5.0.0";
34   src = fetchFromGitHub {
35     owner = "qbittorrent";
36     repo = "qBittorrent";
37     rev = "release-${version}";
38     hash = "sha256-iwqJaRfwJTL6SimWTNqqqFPXxSKrgo6whYY70llZyGs";
39   };
41   nativeBuildInputs = [
42     cmake
43     ninja
44     wrapGAppsHook3
45     wrapQtAppsHook
46   ];
48   buildInputs = [
49     boost
50     libtorrent-rasterbar
51     qtbase
52     qtsvg
53     qttools
54   ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
55     Cocoa
56   ] ++ lib.optionals guiSupport [
57     dbus
58   ] ++ lib.optionals (guiSupport && stdenv.hostPlatform.isLinux) [
59     qtwayland
60   ] ++ lib.optionals trackerSearch [
61     python3
62   ];
64   cmakeFlags = lib.optionals (!guiSupport) [
65     "-DGUI=OFF"
66     "-DSYSTEMD=ON"
67     "-DSYSTEMD_SERVICES_INSTALL_DIR=${placeholder "out"}/lib/systemd/system"
68   ] ++ lib.optionals (!webuiSupport) [
69     "-DWEBUI=OFF"
70   ];
72   qtWrapperArgs = lib.optionals trackerSearch [
73     "--prefix PATH : ${lib.makeBinPath [ python3 ]}"
74   ];
76   dontWrapGApps = true;
78   postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
79     APP_NAME=qbittorrent${lib.optionalString (!guiSupport) "-nox"}
80     mkdir -p $out/{Applications,bin}
81     cp -R $APP_NAME.app $out/Applications
82     makeWrapper $out/{Applications/$APP_NAME.app/Contents/MacOS,bin}/$APP_NAME
83   '';
85   preFixup = ''
86     qtWrapperArgs+=("''${gappsWrapperArgs[@]}")
87   '';
89   meta = with lib; {
90     description = "Featureful free software BitTorrent client";
91     homepage = "https://www.qbittorrent.org";
92     changelog = "https://github.com/qbittorrent/qBittorrent/blob/release-${version}/Changelog";
93     license = licenses.gpl2Plus;
94     platforms = platforms.unix;
95     maintainers = with maintainers; [ Anton-Latukha kashw2 ];
96     mainProgram =
97       "qbittorrent"
98       + lib.optionalString (!guiSupport) "-nox";
99   };