diff --git a/pkgs/applications/networking/syncthing-gtk/default.nix b/pkgs/applications/networking/syncthing-gtk/default.nix new file mode 100644 index 00000000000..5e4f9738d44 --- /dev/null +++ b/pkgs/applications/networking/syncthing-gtk/default.nix @@ -0,0 +1,56 @@ +{ stdenv, fetchFromGitHub, libnotify, librsvg, psmisc, gtk3, substituteAll, syncthing, wrapGAppsHook, gnome3, buildPythonApplication, dateutil, pyinotify, pygobject3, bcrypt, gobjectIntrospection }: + +buildPythonApplication rec { + version = "0.9.2.7"; + name = "syncthing-gtk-${version}"; + + src = fetchFromGitHub { + owner = "syncthing"; + repo = "syncthing-gtk"; + rev = "v${version}"; + sha256 = "08k7vkibia85klwjxbnzk67h4pphrizka5v9zxwvvv3cisjiclc2"; + }; + + nativeBuildInputs = [ + wrapGAppsHook + # For setup hook populating GI_TYPELIB_PATH + gobjectIntrospection + ]; + + buildInputs = [ + gtk3 (librsvg.override { enableIntrospection = true; }) + libnotify + # Schemas with proxy configuration + gnome3.gsettings_desktop_schemas + ]; + + propagatedBuildInputs = [ + dateutil pyinotify pygobject3 bcrypt + ]; + + 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/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"; + maintainers = with maintainers; [ ]; + platforms = syncthing.meta.platforms; + homepage = https://github.com/syncthing/syncthing-gtk; + license = licenses.gpl2; + }; +} 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 00000000000..6c516e98acb --- /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 +@@ -168,6 +168,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 +@@ -60,7 +60,6 @@ + self.quit_button.connect("clicked", lambda *a : self.emit("cancel")) + # Pages + self.add_page(IntroPage(self)) +- 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 + + 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: diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index bd9f9407adf..b2790304c0f 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -17222,6 +17222,8 @@ with pkgs; syncthing013 = callPackage ../applications/networking/syncthing013 { }; + syncthing-gtk = python2Packages.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 b9b0a61d884..334d09d09d2 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;