biome: 1.9.2 -> 1.9.3
[NixPkgs.git] / pkgs / applications / misc / qsyncthingtray / default.nix
blob68baf5e08ebb3c1ca8d8c84a370c40051b494878
1 { mkDerivation, stdenv, lib, fetchFromGitHub, fetchpatch, procps
2 , qtbase, qtwebengine, qtwebkit
3 , cmake
4 , syncthing
5 , preferQWebView ? false
6 , preferNative   ? true }:
8 mkDerivation rec {
9   version = "0.5.8";
10   pname = "qsyncthingtray";
12   src = fetchFromGitHub {
13     owner  = "sieren";
14     repo   = "QSyncthingTray";
15     rev    = version;
16     sha256 = "1n9g4j7qznvg9zl6x163pi9f7wsc3x6q76i33psnm7x2v1i22x5w";
17   };
19   buildInputs = [ qtbase qtwebengine ] ++ lib.optional preferQWebView qtwebkit;
21   nativeBuildInputs = [ cmake ];
23   cmakeFlags = [ ]
24     ++ lib.optional preferQWebView "-DQST_BUILD_WEBKIT=1"
25     ++ lib.optional preferNative   "-DQST_BUILD_NATIVEBROWSER=1";
27   patches = [ (fetchpatch {
28     name = "support_native_browser.patch";
29     url = "https://patch-diff.githubusercontent.com/raw/sieren/QSyncthingTray/pull/225.patch";
30     sha256 = "0w665xdlsbjxs977pdpzaclxpswf7xys1q3rxriz181lhk2y66yy";
31   }) ] ++ lib.optional (!preferQWebView && !preferNative) ./qsyncthingtray-0.5.8-qt-5.6.3.patch;
33   postPatch = ''
34     ${lib.optionalString stdenv.hostPlatform.isLinux ''
35       substituteInPlace includes/platforms/linux/posixUtils.hpp \
36         --replace '"/usr/local/bin/syncthing"'         '"${syncthing}/bin/syncthing"' \
37         --replace '"pgrep -x'                          '"${procps}/bin/pgrep -x'
38     ''}
40     ${lib.optionalString stdenv.hostPlatform.isDarwin ''
41       substituteInPlace includes/platforms/darwin/macUtils.hpp \
42         --replace '"/usr/local/bin/syncthing"'         '"${syncthing}/bin/syncthing"'
43     ''}
44   '';
46   installPhase = let qst = "qsyncthingtray"; in ''
47     runHook preInstall
49     mkdir -p $out/bin
50     install -m755 QSyncthingTray $out/bin/${qst}
51     ln -s $out/bin/${qst} $out/bin/QSyncthingTray
53     runHook postInstall
54   '';
56   meta = with lib; {
57     homepage = "https://github.com/sieren/QSyncthingTray/";
58     description = "Traybar Application for Syncthing written in C++";
59     longDescription = ''
60         A cross-platform status bar for Syncthing.
61         Currently supports macOS, Windows and Linux.
62         Written in C++ with Qt.
63     '';
64     license = licenses.lgpl3;
65     maintainers = with maintainers; [ zraexy peterhoeg ];
66     platforms = platforms.all;
67     broken = !preferNative || stdenv.hostPlatform.isDarwin;
68   };