summary refs log tree commit diff
path: root/pkgs/applications/misc/qsyncthingtray
diff options
context:
space:
mode:
authorPeter Hoeg <peter@speartail.com>2017-03-03 16:28:48 +0800
committerPeter Hoeg <peter@hoeg.com>2017-03-30 16:53:17 +0800
commit29d9f0e624811cb3255302f773e61c36d1c8c03d (patch)
tree4581bc49cf91d1679372a7ebe5d684cc35036dab /pkgs/applications/misc/qsyncthingtray
parent0843ad10fd5cf984b36cf7e6533a518cab299af4 (diff)
downloadnixlib-29d9f0e624811cb3255302f773e61c36d1c8c03d.tar
nixlib-29d9f0e624811cb3255302f773e61c36d1c8c03d.tar.gz
nixlib-29d9f0e624811cb3255302f773e61c36d1c8c03d.tar.bz2
nixlib-29d9f0e624811cb3255302f773e61c36d1c8c03d.tar.lz
nixlib-29d9f0e624811cb3255302f773e61c36d1c8c03d.tar.xz
nixlib-29d9f0e624811cb3255302f773e61c36d1c8c03d.tar.zst
nixlib-29d9f0e624811cb3255302f773e61c36d1c8c03d.zip
qsyncthingtray: fix program paths
We need this for qsyncthingtray to be able to detect the processes as well.
Diffstat (limited to 'pkgs/applications/misc/qsyncthingtray')
-rw-r--r--pkgs/applications/misc/qsyncthingtray/default.nix41
1 files changed, 30 insertions, 11 deletions
diff --git a/pkgs/applications/misc/qsyncthingtray/default.nix b/pkgs/applications/misc/qsyncthingtray/default.nix
index 0aeb7d7eb8fc..4f95879d5eb2 100644
--- a/pkgs/applications/misc/qsyncthingtray/default.nix
+++ b/pkgs/applications/misc/qsyncthingtray/default.nix
@@ -1,25 +1,44 @@
-{ stdenv, fetchFromGitHub
-, qtbase, qtwebengine
-, qmakeHook }:
+{ stdenv, lib, fetchFromGitHub, procps ? null
+, qtbase, qtwebengine, qtwebkit
+, cmake, makeQtWrapper
+, syncthing, syncthing-inotify ? null
+, preferQWebView ? false }:
 
 stdenv.mkDerivation rec {
   version = "0.5.7";
   name = "qsyncthingtray-${version}";
 
   src = fetchFromGitHub {
-    owner = "sieren";
-    repo = "QSyncthingTray";
-    rev = "${version}";
+    owner  = "sieren";
+    repo   = "QSyncthingTray";
+    rev    = "${version}";
     sha256 = "0crrdpdmlc4ahkvp5znzc4zhfwsdih655q1kfjf0g231mmynxhvq";
   };
 
-  buildInputs = [ qtbase qtwebengine ];
-  nativeBuildInputs = [ qmakeHook ];
+  buildInputs = [ qtbase qtwebengine ] ++ lib.optional preferQWebView qtwebkit;
+  nativeBuildInputs = [ cmake makeQtWrapper ];
   enableParallelBuilding = true;
 
-  postInstall = ''
+  cmakeFlags = lib.optional preferQWebView "-DQST_BUILD_WEBKIT=1";
+
+  postPatch = ''
+    ${lib.optionalString stdenv.isLinux ''
+      substituteInPlace includes/platforms/linux/posixUtils.hpp \
+        --replace '"/usr/local/bin/syncthing"'         '"${syncthing}/bin/syncthing"' \
+        --replace '"/usr/local/bin/syncthing-inotify"' '"${syncthing-inotify}/bin/syncthing-inotify"' \
+        --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 ''
     mkdir -p $out/bin
-    cp binary/QSyncthingTray $out/bin
+    install -m755 QSyncthingTray $out/bin/${qst}
+    ln -s $out/bin/${qst} $out/bin/QSyncthingTray
   '';
 
   meta = with stdenv.lib; {
@@ -31,7 +50,7 @@ stdenv.mkDerivation rec {
         Written in C++ with Qt.
     '';
     license = licenses.lgpl3;
-    maintainers = with maintainers; [ zraexy ];
+    maintainers = with maintainers; [ zraexy peterhoeg ];
     platforms = platforms.all;
     broken = builtins.compareVersions qtbase.version "5.7.0" >= 0;
   };