From 0bbde0f026931a74b6c15487a0e6c24e13336a18 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Fri, 24 Nov 2017 20:56:10 +0100 Subject: [PATCH 1/7] pythonPackages.syncthing-gtk: move to pkgs/applications/networking --- .../networking/syncthing-gtk/default.nix | 41 ++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + pkgs/top-level/python-packages.nix | 42 +------------------ 3 files changed, 45 insertions(+), 40 deletions(-) create mode 100644 pkgs/applications/networking/syncthing-gtk/default.nix diff --git a/pkgs/applications/networking/syncthing-gtk/default.nix b/pkgs/applications/networking/syncthing-gtk/default.nix new file mode 100644 index 000000000000..f47fd2d0fd64 --- /dev/null +++ b/pkgs/applications/networking/syncthing-gtk/default.nix @@ -0,0 +1,41 @@ +{ stdenv, fetchFromGitHub, libnotify, librsvg, psmisc, gtk3, syncthing, python2Packages }: + +python2Packages.buildPythonApplication rec { + version = "0.9.2.3"; + name = "syncthing-gtk-${version}"; + + src = fetchFromGitHub { + owner = "syncthing"; + repo = "syncthing-gtk"; + rev = "v${version}"; + sha256 = "0chl0f0kp6z0z00d1f3xjlicjfr9rzabw39wmjr66fwb5w5hcc42"; + }; + + propagatedBuildInputs = with python2Packages; [ + syncthing dateutil pyinotify libnotify + (librsvg.override { withGTK = true; }) + psmisc pygobject3 gtk3 + ]; + + preFixup = '' + wrapProgram $out/bin/syncthing-gtk \ + --set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE" \ + --prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH" + ''; + + patchPhase = '' + 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/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 "; + maintainers = with maintainers; [ ]; + platforms = syncthing.meta.platforms; + homepage = "https://github.com/syncthing/syncthing-gtk"; + license = licenses.gpl2; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index a48f43fc9ffe..d86bc398230e 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -17189,6 +17189,8 @@ with pkgs; syncthing013 = callPackage ../applications/networking/syncthing013 { }; + syncthing-gtk = callPackage ../applications/networking/syncthing-gtk { }; + syncthing-inotify = callPackage ../applications/networking/syncthing/inotify.nix { }; syncthing-tray = callPackage ../applications/misc/syncthing-tray { }; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index e45418fba46d..4e55bfceecb9 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -17329,46 +17329,8 @@ in { sybil = callPackage ../development/python-modules/sybil { }; - syncthing-gtk = buildPythonPackage rec { - version = "0.9.2.3"; - name = "syncthing-gtk-${version}"; - src = pkgs.fetchFromGitHub { - owner = "syncthing"; - repo = "syncthing-gtk"; - rev = "v${version}"; - sha256 = "0chl0f0kp6z0z00d1f3xjlicjfr9rzabw39wmjr66fwb5w5hcc42"; - }; - - disabled = isPy3k; - - propagatedBuildInputs = with self; [ pkgs.syncthing dateutil pyinotify - pkgs.libnotify - (pkgs.librsvg.override { withGTK = true; }) - pkgs.psmisc pygobject3 pkgs.gtk3 - ]; - - preFixup = '' - wrapProgram $out/bin/syncthing-gtk \ - --set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE" \ - --prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH" - ''; - - patchPhase = '' - 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/wizard.py --replace "/usr/share" "$out/share" - substituteInPlace syncthing-gtk.desktop --replace "/usr/bin/syncthing-gtk" "$out/bin/syncthing-gtk" - ''; - - meta = { - description = " GTK3 & python based GUI for Syncthing "; - maintainers = with maintainers; [ ]; - platforms = pkgs.syncthing.meta.platforms; - homepage = "https://github.com/syncthing/syncthing-gtk"; - license = licenses.gpl2; - }; - }; + # legacy alias + syncthing-gtk = pkgs.syncthing-gtk; systemd = callPackage ../development/python-modules/systemd { inherit (pkgs) pkgconfig systemd; From 58e50b8d588ce5330f7927b5ec50fb28b7f349ab Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Fri, 24 Nov 2017 22:52:57 +0100 Subject: [PATCH 2/7] syncthing-gtk: clean-up --- .../networking/syncthing-gtk/default.nix | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/pkgs/applications/networking/syncthing-gtk/default.nix b/pkgs/applications/networking/syncthing-gtk/default.nix index f47fd2d0fd64..d4e34be36dde 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, python2Packages }: +{ stdenv, fetchFromGitHub, libnotify, librsvg, psmisc, gtk3, syncthing, wrapGAppsHook, gnome3, python2Packages }: python2Packages.buildPythonApplication rec { version = "0.9.2.3"; @@ -11,17 +11,18 @@ python2Packages.buildPythonApplication rec { sha256 = "0chl0f0kp6z0z00d1f3xjlicjfr9rzabw39wmjr66fwb5w5hcc42"; }; - propagatedBuildInputs = with python2Packages; [ - syncthing dateutil pyinotify libnotify - (librsvg.override { withGTK = true; }) - psmisc pygobject3 gtk3 + nativeBuildInputs = [ wrapGAppsHook ]; + + buildInputs = [ + gtk3 (librsvg.override { enableIntrospection = true; }) + libnotify psmisc + # Schemas with proxy configuration + gnome3.gsettings_desktop_schemas ]; - preFixup = '' - wrapProgram $out/bin/syncthing-gtk \ - --set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE" \ - --prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH" - ''; + propagatedBuildInputs = with python2Packages; [ + syncthing dateutil pyinotify pygobject3 + ]; patchPhase = '' substituteInPlace setup.py --replace "version = get_version()" "version = '${version}'" From 3169cfd7824a81a2b9d593ddffa88c9141af21e9 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Sat, 25 Nov 2017 01:33:24 +0100 Subject: [PATCH 3/7] syncthing-gtk: fix syncthing path --- .../networking/syncthing-gtk/default.nix | 12 ++- ...sable-syncthing-binary-configuration.patch | 77 +++++++++++++++++++ 2 files changed, 86 insertions(+), 3 deletions(-) create mode 100644 pkgs/applications/networking/syncthing-gtk/disable-syncthing-binary-configuration.patch diff --git a/pkgs/applications/networking/syncthing-gtk/default.nix b/pkgs/applications/networking/syncthing-gtk/default.nix index d4e34be36dde..ba0666e36181 100644 --- a/pkgs/applications/networking/syncthing-gtk/default.nix +++ b/pkgs/applications/networking/syncthing-gtk/default.nix @@ -17,17 +17,23 @@ python2Packages.buildPythonApplication rec { gtk3 (librsvg.override { enableIntrospection = true; }) libnotify psmisc # Schemas with proxy configuration - gnome3.gsettings_desktop_schemas + syncthing gnome3.gsettings_desktop_schemas ]; propagatedBuildInputs = with python2Packages; [ - syncthing dateutil pyinotify pygobject3 + dateutil pyinotify pygobject3 ]; - patchPhase = '' + patches = [ + ./disable-syncthing-binary-configuration.patch + ]; + + 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" ''; diff --git a/pkgs/applications/networking/syncthing-gtk/disable-syncthing-binary-configuration.patch b/pkgs/applications/networking/syncthing-gtk/disable-syncthing-binary-configuration.patch new file mode 100644 index 000000000000..12ea6bb4f2e2 --- /dev/null +++ b/pkgs/applications/networking/syncthing-gtk/disable-syncthing-binary-configuration.patch @@ -0,0 +1,77 @@ +--- a/find-daemon.glade ++++ b/find-daemon.glade +@@ -112,6 +112,7 @@ + + True + True ++ False + 20 + + +@@ -126,6 +127,7 @@ + _Browse... + True + True ++ False + True + True + 0.51999998092651367 +--- a/syncthing_gtk/configuration.py ++++ b/syncthing_gtk/configuration.py +@@ -166,6 +166,8 @@ + yield k + + def get(self, key): ++ if key == "syncthing_binary": ++ return self.REQUIRED_KEYS[key][1] + return self.values[key] + + def set(self, key, value): +--- a/syncthing_gtk/finddaemondialog.py ++++ b/syncthing_gtk/finddaemondialog.py +@@ -163,7 +163,7 @@ + self["lblDownloadProgress"].set_markup(_("Download failed.")) + self["btDownload"].set_visible(True) + self["pbDownload"].set_visible(False) +- self["vsyncthing_binary"].set_sensitive(True) ++ self["vsyncthing_binary"].set_sensitive(False) + self["btBrowse"].set_sensitive(True) + self["btSave"].set_sensitive(True) + +@@ -179,7 +179,7 @@ + + def cb_extract_finished(self, downloader, *a): + """ Called after extraction is finished """ +- self["vsyncthing_binary"].set_sensitive(True) ++ self["vsyncthing_binary"].set_sensitive(False) + self["btBrowse"].set_sensitive(True) + self["vsyncthing_binary"].set_text(downloader.get_target()) + self["lblDownloadProgress"].set_markup("" + _("Download finished.") + "") +--- a/syncthing_gtk/wizard.py ++++ b/syncthing_gtk/wizard.py +@@ -58,7 +58,6 @@ + self.quit_button.connect("clicked", lambda *a : self.emit("cancel")) + # Pages + self.add_page(IntroPage()) +- self.add_page(FindDaemonPage()) + self.add_page(GenerateKeysPage()) + self.add_page(HttpSettingsPage()) + self.add_page(SaveSettingsPage()) +--- a/ui-settings.glade ++++ b/ui-settings.glade +@@ -943,6 +943,7 @@ + _Browse... + True + True ++ False + True + True + 0.51999998092651367 +@@ -974,6 +975,7 @@ + + True + True ++ False + True + + From a140a0e1dee2f0efacc612e3cfda17e5fa63470e Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Sat, 25 Nov 2017 01:35:50 +0100 Subject: [PATCH 4/7] =?UTF-8?q?syncthing-gtk:=200.9.2.3=20=E2=86=92=200.9.?= =?UTF-8?q?2.7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkgs/applications/networking/syncthing-gtk/default.nix | 6 +++--- .../disable-syncthing-binary-configuration.patch | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkgs/applications/networking/syncthing-gtk/default.nix b/pkgs/applications/networking/syncthing-gtk/default.nix index ba0666e36181..89415b02a07a 100644 --- a/pkgs/applications/networking/syncthing-gtk/default.nix +++ b/pkgs/applications/networking/syncthing-gtk/default.nix @@ -1,14 +1,14 @@ { stdenv, fetchFromGitHub, libnotify, librsvg, psmisc, gtk3, syncthing, wrapGAppsHook, gnome3, python2Packages }: python2Packages.buildPythonApplication rec { - version = "0.9.2.3"; + version = "0.9.2.7"; name = "syncthing-gtk-${version}"; src = fetchFromGitHub { owner = "syncthing"; repo = "syncthing-gtk"; rev = "v${version}"; - sha256 = "0chl0f0kp6z0z00d1f3xjlicjfr9rzabw39wmjr66fwb5w5hcc42"; + sha256 = "08k7vkibia85klwjxbnzk67h4pphrizka5v9zxwvvv3cisjiclc2"; }; nativeBuildInputs = [ wrapGAppsHook ]; @@ -21,7 +21,7 @@ python2Packages.buildPythonApplication rec { ]; propagatedBuildInputs = with python2Packages; [ - dateutil pyinotify pygobject3 + dateutil pyinotify pygobject3 bcrypt ]; patches = [ diff --git a/pkgs/applications/networking/syncthing-gtk/disable-syncthing-binary-configuration.patch b/pkgs/applications/networking/syncthing-gtk/disable-syncthing-binary-configuration.patch index 12ea6bb4f2e2..6c516e98acb1 100644 --- a/pkgs/applications/networking/syncthing-gtk/disable-syncthing-binary-configuration.patch +++ b/pkgs/applications/networking/syncthing-gtk/disable-syncthing-binary-configuration.patch @@ -18,7 +18,7 @@ 0.51999998092651367 --- a/syncthing_gtk/configuration.py +++ b/syncthing_gtk/configuration.py -@@ -166,6 +166,8 @@ +@@ -168,6 +168,8 @@ yield k def get(self, key): @@ -49,10 +49,10 @@ self["lblDownloadProgress"].set_markup("" + _("Download finished.") + "") --- a/syncthing_gtk/wizard.py +++ b/syncthing_gtk/wizard.py -@@ -58,7 +58,6 @@ +@@ -60,7 +60,6 @@ self.quit_button.connect("clicked", lambda *a : self.emit("cancel")) # Pages - self.add_page(IntroPage()) + self.add_page(IntroPage(self)) - self.add_page(FindDaemonPage()) self.add_page(GenerateKeysPage()) self.add_page(HttpSettingsPage()) From 33bfe21e6d5594985b60ac93345e52ba3ba32186 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Fri, 26 Jan 2018 06:10:54 +0100 Subject: [PATCH 5/7] 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 89415b02a07a..a8fced65209b 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 000000000000..0ba5a4f2db84 --- /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: From a1555c022c26eb157133de634dba6a80a1cfef60 Mon Sep 17 00:00:00 2001 From: Benjamin Mellor Date: Fri, 26 Jan 2018 06:21:18 +0100 Subject: [PATCH 6/7] syncthing-gtk: explicitly depend on gobjectIntrospection --- pkgs/applications/networking/syncthing-gtk/default.nix | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/networking/syncthing-gtk/default.nix b/pkgs/applications/networking/syncthing-gtk/default.nix index a8fced65209b..9760ed22025c 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, substituteAll, syncthing, wrapGAppsHook, gnome3, python2Packages }: +{ stdenv, fetchFromGitHub, libnotify, librsvg, psmisc, gtk3, substituteAll, syncthing, wrapGAppsHook, gnome3, python2Packages, gobjectIntrospection }: python2Packages.buildPythonApplication rec { version = "0.9.2.7"; @@ -11,7 +11,11 @@ python2Packages.buildPythonApplication rec { sha256 = "08k7vkibia85klwjxbnzk67h4pphrizka5v9zxwvvv3cisjiclc2"; }; - nativeBuildInputs = [ wrapGAppsHook ]; + nativeBuildInputs = [ + wrapGAppsHook + # For setup hook populating GI_TYPELIB_PATH + gobjectIntrospection + ]; buildInputs = [ gtk3 (librsvg.override { enableIntrospection = true; }) From b02bf83a5223a947f8002504fb9db9dd7e76f3ea Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Fri, 26 Jan 2018 06:24:48 +0100 Subject: [PATCH 7/7] syncthing-gtk: clean up --- pkgs/applications/networking/syncthing-gtk/default.nix | 6 +++--- pkgs/top-level/all-packages.nix | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/applications/networking/syncthing-gtk/default.nix b/pkgs/applications/networking/syncthing-gtk/default.nix index 9760ed22025c..5e4f9738d445 100644 --- a/pkgs/applications/networking/syncthing-gtk/default.nix +++ b/pkgs/applications/networking/syncthing-gtk/default.nix @@ -1,6 +1,6 @@ -{ stdenv, fetchFromGitHub, libnotify, librsvg, psmisc, gtk3, substituteAll, syncthing, wrapGAppsHook, gnome3, python2Packages, gobjectIntrospection }: +{ stdenv, fetchFromGitHub, libnotify, librsvg, psmisc, gtk3, substituteAll, syncthing, wrapGAppsHook, gnome3, buildPythonApplication, dateutil, pyinotify, pygobject3, bcrypt, gobjectIntrospection }: -python2Packages.buildPythonApplication rec { +buildPythonApplication rec { version = "0.9.2.7"; name = "syncthing-gtk-${version}"; @@ -24,7 +24,7 @@ python2Packages.buildPythonApplication rec { gnome3.gsettings_desktop_schemas ]; - propagatedBuildInputs = with python2Packages; [ + propagatedBuildInputs = [ dateutil pyinotify pygobject3 bcrypt ]; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index d86bc398230e..9d1a3691793e 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -17189,7 +17189,7 @@ with pkgs; syncthing013 = callPackage ../applications/networking/syncthing013 { }; - syncthing-gtk = callPackage ../applications/networking/syncthing-gtk { }; + syncthing-gtk = python2Packages.callPackage ../applications/networking/syncthing-gtk { }; syncthing-inotify = callPackage ../applications/networking/syncthing/inotify.nix { };