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