diff options
author | Doron Behar <doron.behar@gmail.com> | 2022-11-10 14:03:26 +0200 |
---|---|---|
committer | Doron Behar <doron.behar@gmail.com> | 2022-11-10 14:03:26 +0200 |
commit | 24afcac7031066696ee2b92432f530c5c4459fd8 (patch) | |
tree | 6bb87823f04de2874461eeee21b70397ad784dfa /pkgs/applications/misc/syncthingtray | |
parent | 78bc5aad0ba0cb904e8425d81f61e30d28dbb625 (diff) |
syncthingtray: Fix Nix wrapped path in autostart desktop generation
Fixes #199596.
Diffstat (limited to 'pkgs/applications/misc/syncthingtray')
-rw-r--r-- | pkgs/applications/misc/syncthingtray/default.nix | 12 | ||||
-rw-r--r-- | pkgs/applications/misc/syncthingtray/use-nix-path-in-autostart.patch | 13 |
2 files changed, 25 insertions, 0 deletions
diff --git a/pkgs/applications/misc/syncthingtray/default.nix b/pkgs/applications/misc/syncthingtray/default.nix index 0b5723fdcb3fe..e96cbb418b40e 100644 --- a/pkgs/applications/misc/syncthingtray/default.nix +++ b/pkgs/applications/misc/syncthingtray/default.nix @@ -1,6 +1,7 @@ { mkDerivation , lib , fetchFromGitHub +, substituteAll , qtbase , qtwebengine , qtdeclarative @@ -31,6 +32,17 @@ mkDerivation rec { sha256 = "sha256-uhVRO9aiYJbUmwDp1+LIYF3wNBbVduVpTtVzaS0oUMU="; }; + 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 + ]; + NIX_CFLAGS_COMPILE = "-DEXEC_NIX_PATH=\"${placeholder "out"}/bin/syncthingtray\""; + buildInputs = [ qtbase cpp-utilities diff --git a/pkgs/applications/misc/syncthingtray/use-nix-path-in-autostart.patch b/pkgs/applications/misc/syncthingtray/use-nix-path-in-autostart.patch new file mode 100644 index 0000000000000..a0907496ff9a7 --- /dev/null +++ b/pkgs/applications/misc/syncthingtray/use-nix-path-in-autostart.patch @@ -0,0 +1,13 @@ +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" |