nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 93 lines 2.4 kB view raw
1{ 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, 15}: 16 17mkDerivation rec { 18 version = "0.5.8"; 19 pname = "qsyncthingtray"; 20 21 src = fetchFromGitHub { 22 owner = "sieren"; 23 repo = "QSyncthingTray"; 24 rev = version; 25 sha256 = "1n9g4j7qznvg9zl6x163pi9f7wsc3x6q76i33psnm7x2v1i22x5w"; 26 }; 27 28 buildInputs = [ 29 qtbase 30 qtwebengine 31 ] 32 ++ lib.optional preferQWebView qtwebkit; 33 34 nativeBuildInputs = [ cmake ]; 35 36 cmakeFlags = 37 [ ] 38 ++ lib.optional preferQWebView "-DQST_BUILD_WEBKIT=1" 39 ++ lib.optional preferNative "-DQST_BUILD_NATIVEBROWSER=1"; 40 41 patches = [ 42 (fetchpatch { 43 name = "support_native_browser.patch"; 44 url = "https://patch-diff.githubusercontent.com/raw/sieren/QSyncthingTray/pull/225.patch"; 45 sha256 = "0w665xdlsbjxs977pdpzaclxpswf7xys1q3rxriz181lhk2y66yy"; 46 }) 47 ] 48 ++ lib.optional (!preferQWebView && !preferNative) ./qsyncthingtray-0.5.8-qt-5.6.3.patch; 49 50 postPatch = '' 51 ${lib.optionalString stdenv.hostPlatform.isLinux '' 52 substituteInPlace includes/platforms/linux/posixUtils.hpp \ 53 --replace '"/usr/local/bin/syncthing"' '"${syncthing}/bin/syncthing"' \ 54 --replace '"pgrep -x' '"${procps}/bin/pgrep -x' 55 ''} 56 57 ${lib.optionalString stdenv.hostPlatform.isDarwin '' 58 substituteInPlace includes/platforms/darwin/macUtils.hpp \ 59 --replace '"/usr/local/bin/syncthing"' '"${syncthing}/bin/syncthing"' 60 ''} 61 ''; 62 63 installPhase = 64 let 65 qst = "qsyncthingtray"; 66 in 67 '' 68 runHook preInstall 69 70 mkdir -p $out/bin 71 install -m755 QSyncthingTray $out/bin/${qst} 72 ln -s $out/bin/${qst} $out/bin/QSyncthingTray 73 74 runHook postInstall 75 ''; 76 77 meta = with lib; { 78 homepage = "https://github.com/sieren/QSyncthingTray/"; 79 description = "Traybar Application for Syncthing written in C++"; 80 longDescription = '' 81 A cross-platform status bar for Syncthing. 82 Currently supports macOS, Windows and Linux. 83 Written in C++ with Qt. 84 ''; 85 license = licenses.lgpl3; 86 maintainers = with maintainers; [ 87 zraexy 88 peterhoeg 89 ]; 90 platforms = platforms.all; 91 broken = !preferNative || stdenv.hostPlatform.isDarwin; 92 }; 93}