From 33bfe21e6d5594985b60ac93345e52ba3ba32186 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Fri, 26 Jan 2018 06:10:54 +0100 Subject: [PATCH] syncthing-gtk: another clean-up --- .../networking/syncthing-gtk/default.nix | 16 +++++++++----- .../networking/syncthing-gtk/paths.patch | 22 +++++++++++++++++++ 2 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 pkgs/applications/networking/syncthing-gtk/paths.patch diff --git a/pkgs/applications/networking/syncthing-gtk/default.nix b/pkgs/applications/networking/syncthing-gtk/default.nix index 89415b02a07..a8fced65209 100644 --- a/pkgs/applications/networking/syncthing-gtk/default.nix +++ b/pkgs/applications/networking/syncthing-gtk/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchFromGitHub, libnotify, librsvg, psmisc, gtk3, syncthing, wrapGAppsHook, gnome3, python2Packages }: +{ stdenv, fetchFromGitHub, libnotify, librsvg, psmisc, gtk3, substituteAll, syncthing, wrapGAppsHook, gnome3, python2Packages }: python2Packages.buildPythonApplication rec { version = "0.9.2.7"; @@ -15,9 +15,9 @@ python2Packages.buildPythonApplication rec { buildInputs = [ gtk3 (librsvg.override { enableIntrospection = true; }) - libnotify psmisc + libnotify # Schemas with proxy configuration - syncthing gnome3.gsettings_desktop_schemas + gnome3.gsettings_desktop_schemas ]; propagatedBuildInputs = with python2Packages; [ @@ -26,23 +26,27 @@ python2Packages.buildPythonApplication rec { patches = [ ./disable-syncthing-binary-configuration.patch + (substituteAll { + src = ./paths.patch; + killall = "${psmisc}/bin/killall"; + syncthing = "${syncthing}/bin/syncthing"; + }) ]; postPatch = '' substituteInPlace setup.py --replace "version = get_version()" "version = '${version}'" substituteInPlace scripts/syncthing-gtk --replace "/usr/share" "$out/share" substituteInPlace syncthing_gtk/app.py --replace "/usr/share" "$out/share" - substituteInPlace syncthing_gtk/configuration.py --replace "/usr/bin/syncthing" "${syncthing}/bin/syncthing" substituteInPlace syncthing_gtk/uisettingsdialog.py --replace "/usr/share" "$out/share" substituteInPlace syncthing_gtk/wizard.py --replace "/usr/share" "$out/share" substituteInPlace syncthing-gtk.desktop --replace "/usr/bin/syncthing-gtk" "$out/bin/syncthing-gtk" ''; meta = with stdenv.lib; { - description = " GTK3 & python based GUI for Syncthing "; + description = "GTK3 & python based GUI for Syncthing"; maintainers = with maintainers; [ ]; platforms = syncthing.meta.platforms; - homepage = "https://github.com/syncthing/syncthing-gtk"; + homepage = https://github.com/syncthing/syncthing-gtk; license = licenses.gpl2; }; } diff --git a/pkgs/applications/networking/syncthing-gtk/paths.patch b/pkgs/applications/networking/syncthing-gtk/paths.patch new file mode 100644 index 00000000000..0ba5a4f2db8 --- /dev/null +++ b/pkgs/applications/networking/syncthing-gtk/paths.patch @@ -0,0 +1,22 @@ +--- a/syncthing_gtk/configuration.py ++++ b/syncthing_gtk/configuration.py +@@ -30,7 +30,7 @@ + "autokill_daemon" : (int, 2), # 0 - never kill, 1 - always kill, 2 - ask + "daemon_priority" : (int, 0), # uses nice values + "max_cpus" : (int, 0), # 0 for all cpus +- "syncthing_binary" : (str, "/usr/bin/syncthing"), ++ "syncthing_binary" : (str, "@syncthing@"), + "syncthing_arguments" : (str, ""), + "minimize_on_start" : (bool, False), + "folder_as_path" : (bool, True), +--- a/syncthing_gtk/tools.py ++++ b/syncthing_gtk/tools.py +@@ -303,7 +303,7 @@ + return False + # signal 0 doesn't kill anything, but killall exits with 1 if + # named process is not found +- p = Popen(["killall", "-u", os.environ["USER"], "-q", "-s", "0", "syncthing"]) ++ p = Popen(["@killall@", "-u", os.environ["USER"], "-q", "-s", "0", "syncthing"]) + p.communicate() + return p.returncode == 0 + else: