2018-03-27 01:42:46 +02:00
|
|
|
{ mkDerivation, stdenv, lib, fetchFromGitHub, fetchpatch, procps
|
2017-03-03 09:28:48 +01:00
|
|
|
, qtbase, qtwebengine, qtwebkit
|
2017-05-17 21:26:11 +02:00
|
|
|
, cmake
|
2018-02-23 19:59:06 +01:00
|
|
|
, syncthing
|
2017-12-20 02:41:52 +01:00
|
|
|
, preferQWebView ? false
|
|
|
|
, preferNative ? true }:
|
2016-10-31 21:06:32 +01:00
|
|
|
|
2017-05-17 21:26:11 +02:00
|
|
|
mkDerivation rec {
|
2017-07-07 21:20:19 +02:00
|
|
|
version = "0.5.8";
|
2016-10-31 21:06:32 +01:00
|
|
|
name = "qsyncthingtray-${version}";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2017-03-03 09:28:48 +01:00
|
|
|
owner = "sieren";
|
|
|
|
repo = "QSyncthingTray";
|
|
|
|
rev = "${version}";
|
2017-07-07 21:20:19 +02:00
|
|
|
sha256 = "1n9g4j7qznvg9zl6x163pi9f7wsc3x6q76i33psnm7x2v1i22x5w";
|
2016-10-31 21:06:32 +01:00
|
|
|
};
|
|
|
|
|
2017-03-03 09:28:48 +01:00
|
|
|
buildInputs = [ qtbase qtwebengine ] ++ lib.optional preferQWebView qtwebkit;
|
2017-12-20 02:41:52 +01:00
|
|
|
|
2017-05-17 21:26:11 +02:00
|
|
|
nativeBuildInputs = [ cmake ];
|
2017-03-13 04:46:02 +01:00
|
|
|
|
2017-12-20 02:41:52 +01:00
|
|
|
cmakeFlags = [ ]
|
|
|
|
++ lib.optional preferQWebView "-DQST_BUILD_WEBKIT=1"
|
|
|
|
++ lib.optional preferNative "-DQST_BUILD_NATIVEBROWSER=1";
|
2017-03-03 09:28:48 +01:00
|
|
|
|
2017-12-20 02:41:52 +01:00
|
|
|
patches = [ (fetchpatch {
|
|
|
|
name = "support_native_browser.patch";
|
|
|
|
url = "https://patch-diff.githubusercontent.com/raw/sieren/QSyncthingTray/pull/225.patch";
|
|
|
|
sha256 = "0w665xdlsbjxs977pdpzaclxpswf7xys1q3rxriz181lhk2y66yy";
|
|
|
|
}) ] ++ lib.optional (!preferQWebView && !preferNative) ./qsyncthingtray-0.5.8-qt-5.6.3.patch;
|
2017-11-17 04:05:30 +01:00
|
|
|
|
2017-03-03 09:28:48 +01:00
|
|
|
postPatch = ''
|
|
|
|
${lib.optionalString stdenv.isLinux ''
|
|
|
|
substituteInPlace includes/platforms/linux/posixUtils.hpp \
|
|
|
|
--replace '"/usr/local/bin/syncthing"' '"${syncthing}/bin/syncthing"' \
|
|
|
|
--replace '"pgrep -x' '"${procps}/bin/pgrep -x'
|
|
|
|
''}
|
|
|
|
|
|
|
|
${lib.optionalString stdenv.isDarwin ''
|
|
|
|
substituteInPlace includes/platforms/darwin/macUtils.hpp \
|
|
|
|
--replace '"/usr/local/bin/syncthing"' '"${syncthing}/bin/syncthing"'
|
|
|
|
''}
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = let qst = "qsyncthingtray"; in ''
|
2017-04-27 06:06:26 +02:00
|
|
|
runHook preInstall
|
|
|
|
|
2016-10-31 21:06:32 +01:00
|
|
|
mkdir -p $out/bin
|
2017-03-03 09:28:48 +01:00
|
|
|
install -m755 QSyncthingTray $out/bin/${qst}
|
|
|
|
ln -s $out/bin/${qst} $out/bin/QSyncthingTray
|
2017-04-27 06:06:26 +02:00
|
|
|
|
|
|
|
runHook postInstall
|
2016-10-31 21:06:32 +01:00
|
|
|
'';
|
|
|
|
|
2017-11-17 04:05:30 +01:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2017-05-17 21:26:11 +02:00
|
|
|
meta = with lib; {
|
2016-10-31 21:06:32 +01:00
|
|
|
homepage = https://github.com/sieren/QSyncthingTray/;
|
|
|
|
description = "A Traybar Application for Syncthing written in C++";
|
|
|
|
longDescription = ''
|
|
|
|
A cross-platform status bar for Syncthing.
|
2017-08-07 00:05:18 +02:00
|
|
|
Currently supports macOS, Windows and Linux.
|
2016-10-31 21:06:32 +01:00
|
|
|
Written in C++ with Qt.
|
|
|
|
'';
|
|
|
|
license = licenses.lgpl3;
|
2017-03-03 09:28:48 +01:00
|
|
|
maintainers = with maintainers; [ zraexy peterhoeg ];
|
2016-10-31 21:06:32 +01:00
|
|
|
platforms = platforms.all;
|
2017-05-12 10:45:27 +02:00
|
|
|
# 0.5.7 segfaults when opening the main panel with qt 5.7 and fails to compile with qt 5.8
|
2017-12-20 02:41:52 +01:00
|
|
|
# but qt > 5.6 works when only using the native browser
|
|
|
|
# https://github.com/sieren/QSyncthingTray/issues/223
|
|
|
|
broken = (builtins.compareVersions qtbase.version "5.7.0" >= 0 && !preferNative);
|
2016-10-31 21:06:32 +01:00
|
|
|
};
|
|
|
|
}
|