flatpak: Fix flatpak path in launchers

This commit is contained in:
Victor Fuentes 2023-03-22 23:57:51 -04:00
parent e35dcc04a3
commit 81b2e15c2c
2 changed files with 34 additions and 7 deletions

View file

@ -0,0 +1,29 @@
diff --git a/common/flatpak-dir.c b/common/flatpak-dir.c
index eba81fef..134024e2 100644
--- a/common/flatpak-dir.c
+++ b/common/flatpak-dir.c
@@ -7532,8 +7532,13 @@ export_desktop_file (const char *app,
g_key_file_remove_key (keyfile, groups[i], "X-GNOME-Bugzilla-ExtraInfoScript", NULL);
new_exec = g_string_new ("");
- if ((flatpak = g_getenv ("FLATPAK_BINARY")) == NULL)
- flatpak = FLATPAK_BINDIR "/flatpak";
+ if (g_str_has_suffix (name, ".service"))
+ {
+ flatpak = "/run/current-system/sw/bin/flatpak";
+ } else {
+ if ((flatpak = g_getenv ("FLATPAK_BINARY")) == NULL)
+ flatpak = "flatpak";
+ }
g_string_append_printf (new_exec,
"%s run --branch=%s --arch=%s",
@@ -8867,7 +8872,7 @@ flatpak_dir_deploy (FlatpakDir *self,
error))
return FALSE;
if ((flatpak = g_getenv ("FLATPAK_BINARY")) == NULL)
- flatpak = FLATPAK_BINDIR "/flatpak";
+ flatpak = "flatpak";
bin_data = g_strdup_printf ("#!/bin/sh\nexec %s run --branch=%s --arch=%s %s \"$@\"\n",
flatpak, escaped_branch, escaped_arch, escaped_app);

View file

@ -89,6 +89,11 @@ stdenv.mkDerivation (finalAttrs: {
# https://github.com/NixOS/nixpkgs/issues/53441
./unset-env-vars.patch
# Use flatpak from PATH to avoid references to `/nix/store` in `/desktop` files.
# Applications containing `DBusActivatable` entries should be able to find the flatpak binary.
# https://github.com/NixOS/nixpkgs/issues/138956
./binary-path.patch
# The icon validator needs to access the gdk-pixbuf loaders in the Nix store
# and cannot bind FHS paths since those are not available on NixOS.
finalAttrs.passthru.icon-validator-patch
@ -176,13 +181,6 @@ stdenv.mkDerivation (finalAttrs: {
PATH=${lib.makeBinPath [vsc-py]}:$PATH patchShebangs --build subprojects/variant-schema-compiler/variant-schema-compiler
'';
preFixup = ''
gappsWrapperArgs+=(
# Use flatpak from PATH in exported assets (e.g. desktop files).
--set FLATPAK_BINARY flatpak
)
'';
passthru = {
icon-validator-patch = substituteAll {
src = ./fix-icon-validation.patch;