diff --git a/pkgs/applications/misc/syncthingtray/default.nix b/pkgs/applications/misc/syncthingtray/default.nix index 5d583181ce65..99404d38efee 100644 --- a/pkgs/applications/misc/syncthingtray/default.nix +++ b/pkgs/applications/misc/syncthingtray/default.nix @@ -19,30 +19,25 @@ , kioPluginSupport ? true , plasmoidSupport ? true , systemdSupport ? true +/* It is possible to set via this option an absolute exec path that will be +written to the `~/.config/autostart/syncthingtray.desktop` file generated +during runtime. Alternatively, one can edit the desktop file themselves after +it is generated See: +https://github.com/NixOS/nixpkgs/issues/199596#issuecomment-1310136382 */ +, autostartExecPath ? "syncthingtray" }: mkDerivation rec { - version = "1.3.1"; + version = "1.3.2"; pname = "syncthingtray"; src = fetchFromGitHub { owner = "Martchus"; repo = "syncthingtray"; rev = "v${version}"; - sha256 = "sha256-0rmfDkPvgubVqfbIOZ+mnv/x1p2sb88zGeg/Q2JCy3I="; + sha256 = "sha256-zLZw6ltdgO66dvKdLXhr/a6r8UhbSAx06jXrgMARHyw="; }; - patches = [ - # Fix Exec= path in runtime-generated - # ~/.config/autostart/syncthingtray.desktop file - this is required because - # we are wrapping the executable. We can't use `substituteAll` because we - # can't use `${placeholder "out"}` because that will produce the $out of - # the patch derivation itself, and not of syncthing's "out" placeholder. - # Hence we use a C definition with NIX_CFLAGS_COMPILE - ./use-nix-path-in-autostart.patch - ]; - env.NIX_CFLAGS_COMPILE = "-DEXEC_NIX_PATH=\"${placeholder "out"}/bin/syncthingtray\""; - buildInputs = [ qtbase cpp-utilities @@ -70,6 +65,7 @@ mkDerivation rec { ''; cmakeFlags = [ + "-DAUTOSTART_EXEC_PATH=${autostartExecPath}" # See https://github.com/Martchus/syncthingtray/issues/42 "-DQT_PLUGIN_DIR:STRING=${placeholder "out"}/lib/qt-5" ] ++ lib.optionals (!plasmoidSupport) ["-DNO_PLASMOID=ON"] diff --git a/pkgs/applications/misc/syncthingtray/use-nix-path-in-autostart.patch b/pkgs/applications/misc/syncthingtray/use-nix-path-in-autostart.patch deleted file mode 100644 index a0907496ff9a..000000000000 --- a/pkgs/applications/misc/syncthingtray/use-nix-path-in-autostart.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git i/widgets/settings/settingsdialog.cpp w/widgets/settings/settingsdialog.cpp -index 4deff1f..16845b5 100644 ---- i/widgets/settings/settingsdialog.cpp -+++ w/widgets/settings/settingsdialog.cpp -@@ -802,7 +802,7 @@ bool setAutostartEnabled(bool enabled) - desktopFile.write("[Desktop Entry]\n" - "Name=" APP_NAME "\n" - "Exec=\""); -- desktopFile.write(qEnvironmentVariable("APPIMAGE", QCoreApplication::applicationFilePath()).toUtf8().data()); -+ desktopFile.write(qEnvironmentVariable("APPIMAGE", EXEC_NIX_PATH).toUtf8().data()); - desktopFile.write("\" qt-widgets-gui --single-instance\nComment=" APP_DESCRIPTION "\n" - "Icon=" PROJECT_NAME "\n" - "Type=Application\n"