Andrey Petrov 2021-10-16 16:35:38 -04:00
parent 6605999f19
commit 3c3fc76c13
3 changed files with 19 additions and 67 deletions

View File

@ -7,7 +7,7 @@ index 9e885070..d02eeb8c 100644
"--unshare-net",
"--unshare-pid",
- "--ro-bind", "/usr", "/usr",
- "--ro-bind", "/etc/ld.so.cache", "/etc/ld.so.cache",
- "--ro-bind-try", "/etc/ld.so.cache", "/etc/ld.so.cache",
+ "--ro-bind", "@storeDir@", "@storeDir@",
+ "--ro-bind", "/run/current-system", "/run/current-system",
"--ro-bind", validate_icon, validate_icon,

View File

@ -49,18 +49,19 @@
, dconf
, gsettings-desktop-schemas
, librsvg
, makeWrapper
}:
stdenv.mkDerivation rec {
pname = "flatpak";
version = "1.10.2";
version = "1.12.2";
# TODO: split out lib once we figure out what to do with triggerdir
outputs = [ "out" "dev" "man" "doc" "devdoc" "installedTests" ];
src = fetchurl {
url = "https://github.com/flatpak/flatpak/releases/download/${version}/${pname}-${version}.tar.xz";
sha256 = "sha256-2xUnOdBy+P8pnk6IjYljobRTjaexDguGUlvkOPLh3eQ=";
sha256 = "df1eb464f9142c11627f99f04f6a5c02c868bbb145489b8902cb6c105e774b75"; # Taken from https://github.com/flatpak/flatpak/releases/
};
patches = [
@ -90,25 +91,19 @@ stdenv.mkDerivation rec {
# Patch taken from gtk-doc expression.
./respect-xml-catalog-files-var.patch
# Dont hardcode flatpak binary path in launchers stored under users profile otherwise they will break after Flatpak update.
# https://github.com/NixOS/nixpkgs/issues/43581
./use-flatpak-from-path.patch
# Hardcode flatpak binary path for flatpak-spawn.
# When calling the portals Spawn command with FLATPAK_SPAWN_FLAGS_CLEAR_ENV flag,
# it will clear environment, including PATH, making the flatpak run fail.
# https://github.com/flatpak/flatpak/pull/4174
(fetchpatch {
url = "https://github.com/flatpak/flatpak/commit/495449daf6d3c072519a36c9e4bc6cc1da4d31db.patch";
sha256 = "gOX/sGupAE7Yg3MVrMhFXzWHpFn+izVyjtkuPzIckuY=";
})
# Nix environment hacks should not leak into the apps.
# https://github.com/NixOS/nixpkgs/issues/53441
./unset-env-vars.patch
# But we want the GDK_PIXBUF_MODULE_FILE from the wrapper affect the icon validator.
./validate-icon-pixbuf.patch
# Tests don't respect the FLATPAK_BINARY override that was added, this is a workaround.
# https://github.com/flatpak/flatpak/pull/4496 (Can be removed once included).
(fetchpatch {
url = "https://github.com/flatpak/flatpak/commit/96dbe28cfa96e80b23fa1d8072eb36edad41279c.patch";
sha256 = "1jczk06ymfs98h3nsg245g0jwxvml7wg2x6pb7mrfpsdmrpz2czd";
})
];
nativeBuildInputs = [
@ -189,7 +184,14 @@ stdenv.mkDerivation rec {
in ''
patchShebangs buildutil
patchShebangs tests
PATH=${lib.makeBinPath [vsc-py]}:$PATH patchShebangs --build variant-schema-compiler/variant-schema-compiler
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 = {

View File

@ -1,50 +0,0 @@
diff --git a/common/flatpak-dir.c b/common/flatpak-dir.c
index 52b222ea..9489441f 100644
--- a/common/flatpak-dir.c
+++ b/common/flatpak-dir.c
@@ -6956,7 +6956,7 @@ export_desktop_file (const char *app,
new_exec = g_string_new ("");
g_string_append_printf (new_exec,
- FLATPAK_BINDIR "/flatpak run --branch=%s --arch=%s",
+ "flatpak run --branch=%s --arch=%s",
escaped_branch,
escaped_arch);
@@ -8290,8 +8290,8 @@ flatpak_dir_deploy (FlatpakDir *self,
error))
return FALSE;
- bin_data = g_strdup_printf ("#!/bin/sh\nexec %s/flatpak run --branch=%s --arch=%s %s \"$@\"\n",
- FLATPAK_BINDIR, escaped_branch, escaped_arch, escaped_app);
+ bin_data = g_strdup_printf ("#!/bin/sh\nexec flatpak run --branch=%s --arch=%s %s \"$@\"\n",
+ escaped_branch, escaped_arch, escaped_app);
if (!g_file_replace_contents (wrapper, bin_data, strlen (bin_data), NULL, FALSE,
G_FILE_CREATE_REPLACE_DESTINATION, NULL, cancellable, error))
return FALSE;
diff --git a/tests/test-bundle.sh b/tests/test-bundle.sh
index d1682344..5e2b9a97 100755
--- a/tests/test-bundle.sh
+++ b/tests/test-bundle.sh
@@ -67,7 +67,7 @@ assert_has_dir $FL_DIR/app/org.test.Hello/$ARCH/master/active/files
assert_has_dir $FL_DIR/app/org.test.Hello/$ARCH/master/active/export
assert_has_file $FL_DIR/exports/share/applications/org.test.Hello.desktop
# Ensure Exec key is rewritten
-assert_file_has_content $FL_DIR/exports/share/applications/org.test.Hello.desktop "^Exec=.*/flatpak run --branch=master --arch=$ARCH --command=hello\.sh org\.test\.Hello$"
+assert_file_has_content $FL_DIR/exports/share/applications/org.test.Hello.desktop "^Exec=flatpak run --branch=master --arch=$ARCH --command=hello\.sh org\.test\.Hello$"
assert_has_file $FL_DIR/exports/share/icons/hicolor/64x64/apps/org.test.Hello.png
assert_has_file $FL_DIR/exports/share/icons/HighContrast/64x64/apps/org.test.Hello.png
diff --git a/tests/test-run.sh b/tests/test-run.sh
index fecb756e..64043281 100644
--- a/tests/test-run.sh
+++ b/tests/test-run.sh
@@ -45,7 +45,7 @@ assert_has_dir $FL_DIR/app/org.test.Hello/$ARCH/stable/active/files
assert_has_dir $FL_DIR/app/org.test.Hello/$ARCH/stable/active/export
assert_has_file $FL_DIR/exports/share/applications/org.test.Hello.desktop
# Ensure Exec key is rewritten
-assert_file_has_content $FL_DIR/exports/share/applications/org.test.Hello.desktop "^Exec=.*/flatpak run --branch=stable --arch=$ARCH --command=hello\.sh org\.test\.Hello$"
+assert_file_has_content $FL_DIR/exports/share/applications/org.test.Hello.desktop "^Exec=flatpak run --branch=stable --arch=$ARCH --command=hello\.sh org\.test\.Hello$"
assert_has_file $FL_DIR/exports/share/gnome-shell/search-providers/org.test.Hello.search-provider.ini
assert_file_has_content $FL_DIR/exports/share/gnome-shell/search-providers/org.test.Hello.search-provider.ini "^DefaultDisabled=true$"
assert_has_file $FL_DIR/exports/share/icons/hicolor/64x64/apps/org.test.Hello.png