diff --git a/nixos/tests/installed-tests/xdg-desktop-portal.nix b/nixos/tests/installed-tests/xdg-desktop-portal.nix index d40317faeb015..2b1534eb1785f 100644 --- a/nixos/tests/installed-tests/xdg-desktop-portal.nix +++ b/nixos/tests/installed-tests/xdg-desktop-portal.nix @@ -9,9 +9,20 @@ makeInstalledTest { # Failed connect to PipeWire: Couldn't connect to PipeWire testConfig = { environment.variables = { - TEST_IN_CI = 1; + XDP_TEST_IN_CI = 1; XDG_DATA_DIRS = "${pkgs.xdg-desktop-portal.installedTests}/share/installed-tests/xdg-desktop-portal/share"; }; + environment.systemPackages = with pkgs; [ + (python3.withPackages ( + pp: with pp; [ + pygobject3 + sphinxext-opengraph + sphinx-copybutton + furo + ] + )) + wireless-regdb + ]; # Broken, see comment in the package file. #services.geoclue2 = { # enable = true; diff --git a/pkgs/development/libraries/xdg-desktop-portal/default.nix b/pkgs/development/libraries/xdg-desktop-portal/default.nix index 79c7633a5576b..66fa13008d84a 100644 --- a/pkgs/development/libraries/xdg-desktop-portal/default.nix +++ b/pkgs/development/libraries/xdg-desktop-portal/default.nix @@ -29,13 +29,18 @@ wrapGAppsHook3, xmlto, bash, + gst_all_1, + libgudev, + umockdev, + sphinx, + substituteAll, enableGeoLocation ? true, enableSystemd ? true, }: stdenv.mkDerivation (finalAttrs: { pname = "xdg-desktop-portal"; - version = "1.18.4"; + version = "1.19.2"; outputs = [ "out" @@ -45,18 +50,17 @@ stdenv.mkDerivation (finalAttrs: { src = fetchFromGitHub { owner = "flatpak"; repo = "xdg-desktop-portal"; - rev = finalAttrs.version; - hash = "sha256-o+aO7uGewDPrtgOgmp/CE2uiqiBLyo07pVCFrtlORFQ="; + tag = finalAttrs.version; + hash = "sha256-LV9+t8VAA+gdUKzPMALP9q6EE0Y2hJe/i8zfh7Zgmu4="; }; patches = [ # The icon validator copied from Flatpak needs to access the gdk-pixbuf loaders # in the Nix store and cannot bind FHS paths since those are not available on NixOS. - (runCommand "icon-validator.patch" { } '' - # Flatpak uses a different path - substitute "${flatpak.icon-validator-patch}" "$out" \ - --replace "/icon-validator/validate-icon.c" "/src/validate-icon.c" - '') + (substituteAll { + src = ./fix-icon-validation.patch; + inherit (builtins) storeDir; + }) # Allow installing installed tests to a separate output. ./installed-tests-path.patch @@ -68,10 +72,6 @@ stdenv.mkDerivation (finalAttrs: { # test tries to read /proc/cmdline, which is not intended to be accessible in the sandbox ./trash-test.patch - - # Install files required to be in XDG_DATA_DIR of the installed tests - # Merged PR https://github.com/flatpak/xdg-desktop-portal/pull/1444 - ./installed-tests-share.patch ]; nativeBuildInputs = [ @@ -85,6 +85,18 @@ stdenv.mkDerivation (finalAttrs: { pkg-config wrapGAppsHook3 xmlto + sphinx + gst_all_1.gstreamer + gst_all_1.gst-plugins-good + # For document-fuse installed test. + (python3.withPackages ( + pp: with pp; [ + pygobject3 + sphinxext-opengraph + sphinx-copybutton + furo + ] + )) ]; buildInputs = @@ -97,17 +109,13 @@ stdenv.mkDerivation (finalAttrs: { json-glib libportal pipewire + gst_all_1.gst-plugins-base + libgudev + umockdev # For icon validator gdk-pixbuf librsvg - - # For document-fuse installed test. - (python3.withPackages ( - pp: with pp; [ - pygobject3 - ] - )) bash ] ++ lib.optionals enableGeoLocation [ @@ -155,6 +163,9 @@ stdenv.mkDerivation (finalAttrs: { } substituteInPlace tests/test-portals.c \ --replace-fail 'g_test_add_func ("/portal/notification/bad-arg", test_notification_bad_arg);' "" + + patchShebangs src/generate-method-info.py + patchShebangs doc/fix-rst-dbus.py ''; preCheck = '' @@ -165,23 +176,22 @@ stdenv.mkDerivation (finalAttrs: { # be flaky. Let's disable those downstream as hydra exhibits similar # flakes: # https://github.com/NixOS/nixpkgs/pull/270085#issuecomment-1840053951 - export TEST_IN_CI=1 + export XDP_TEST_IN_CI=1 + + export XDP_VALIDATE_SOUND_INSECURE=1 # For validate-sound: Failed to create gstreamer discoverer: Couldn't create 'uridecodebin' element + + export LD_PRELOAD=$LD_PRELOAD:${lib.getLib umockdev}/lib/libumockdev-preload.so ''; postFixup = let documentFuse = "${placeholder "installedTests"}/libexec/installed-tests/xdg-desktop-portal/test-document-fuse.py"; testPortals = "${placeholder "installedTests"}/libexec/installed-tests/xdg-desktop-portal/test-portals"; - in '' if [ -x '${documentFuse}' ] ; then wrapGApp '${documentFuse}' wrapGApp '${testPortals}' - # (xdg-desktop-portal:995): xdg-desktop-portal-WARNING **: 21:21:55.673: Failed to get GeoClue client: Timeout was reached - # xdg-desktop-portal:ERROR:../tests/location.c:22:location_cb: 'res' should be TRUE - # https://github.com/flatpak/xdg-desktop-portal/blob/1d6dfb57067dec182b546dfb60c87aa3452c77ed/tests/location.c#L21 - rm $installedTests/share/installed-tests/xdg-desktop-portal/test-portals-location.test fi ''; @@ -196,11 +206,11 @@ stdenv.mkDerivation (finalAttrs: { }; }; - meta = with lib; { + meta = { description = "Desktop integration portals for sandboxed apps"; - homepage = "https://flatpak.github.io/xdg-desktop-portal/"; - license = licenses.lgpl2Plus; - maintainers = with maintainers; [ jtojnar ]; - platforms = platforms.linux; + homepage = "https://flatpak.github.io/xdg-desktop-portal"; + license = lib.licenses.lgpl2Plus; + maintainers = with lib.maintainers; [ jtojnar ]; + platforms = lib.platforms.linux; }; }) diff --git a/pkgs/development/libraries/xdg-desktop-portal/fix-icon-validation.patch b/pkgs/development/libraries/xdg-desktop-portal/fix-icon-validation.patch new file mode 100644 index 0000000000000..08b7a3c0b3b02 --- /dev/null +++ b/pkgs/development/libraries/xdg-desktop-portal/fix-icon-validation.patch @@ -0,0 +1,33 @@ +diff --git a/src/validate-icon.c b/src/validate-icon.c +index c42265b..320f028 100644 +--- a/src/validate-icon.c ++++ b/src/validate-icon.c +@@ -254,7 +254,7 @@ flatpak_get_bwrap (void) + static int + rerun_in_sandbox (int input_fd) + { +- const char * const usrmerged_dirs[] = { "bin", "lib32", "lib64", "lib", "sbin" }; ++ const char * const usrmerged_dirs[] = { }; + g_autoptr(GPtrArray) args = g_ptr_array_new_with_free_func (g_free); + g_autofree char* arg_input_fd = NULL; + char validate_icon[PATH_MAX + 1]; +@@ -276,8 +276,7 @@ rerun_in_sandbox (int input_fd) + "--unshare-ipc", + "--unshare-net", + "--unshare-pid", +- "--ro-bind", "/usr", "/usr", +- "--ro-bind-try", "/etc/ld.so.cache", "/etc/ld.so.cache", ++ "--ro-bind", "@storeDir@", "@storeDir@", + "--ro-bind", validate_icon, validate_icon, + NULL); + +@@ -320,6 +319,9 @@ rerun_in_sandbox (int input_fd) + if (g_getenv ("G_MESSAGES_PREFIXED")) + add_args (args, "--setenv", "G_MESSAGES_PREFIXED", g_getenv ("G_MESSAGES_PREFIXED"), NULL); + ++ if (g_getenv ("GDK_PIXBUF_MODULE_FILE")) ++ add_args (args, "--setenv", "GDK_PIXBUF_MODULE_FILE", g_getenv ("GDK_PIXBUF_MODULE_FILE"), NULL); ++ + arg_input_fd = g_strdup_printf ("%d", input_fd); + add_args (args, + validate_icon, diff --git a/pkgs/development/libraries/xdg-desktop-portal/installed-tests-path.patch b/pkgs/development/libraries/xdg-desktop-portal/installed-tests-path.patch index 0a9547ba3628e..704c30aa78cd4 100644 --- a/pkgs/development/libraries/xdg-desktop-portal/installed-tests-path.patch +++ b/pkgs/development/libraries/xdg-desktop-portal/installed-tests-path.patch @@ -1,8 +1,8 @@ diff --git a/meson.build b/meson.build -index b25f9ef..7975f85 100644 +index 26da8a4..d4f95ec 100644 --- a/meson.build +++ b/meson.build -@@ -40,8 +40,8 @@ if dataroot_dir == '' +@@ -43,8 +43,8 @@ if dataroot_dir == '' dataroot_dir = datadir endif @@ -14,10 +14,10 @@ index b25f9ef..7975f85 100644 summary({ diff --git a/meson_options.txt b/meson_options.txt -index fccada3..ca87600 100644 +index 64d9bd3..34675f6 100644 --- a/meson_options.txt +++ b/meson_options.txt -@@ -38,6 +38,10 @@ option('installed-tests', +@@ -42,6 +42,10 @@ option('installed-tests', type: 'boolean', value: false, description: 'Enable installation of some test cases') @@ -27,4 +27,4 @@ index fccada3..ca87600 100644 + description: 'Prefix for installed tests') option('pytest', type: 'feature', - value: 'auto', + value: 'enabled', diff --git a/pkgs/development/libraries/xdg-desktop-portal/installed-tests-share.patch b/pkgs/development/libraries/xdg-desktop-portal/installed-tests-share.patch deleted file mode 100644 index ba9a3822e59e3..0000000000000 --- a/pkgs/development/libraries/xdg-desktop-portal/installed-tests-share.patch +++ /dev/null @@ -1,9 +0,0 @@ -diff --git a/tests/share/applications/meson.build b/tests/share/applications/meson.build -index d56b633..3ad3371 100644 ---- a/tests/share/applications/meson.build -+++ b/tests/share/applications/meson.build -@@ -1,2 +1,2 @@ --configure_file(input: 'furrfix.desktop', output: '@PLAINNAME@', copy: true) --configure_file(input: 'mimeinfo.cache', output: '@PLAINNAME@', copy: true) -+configure_file(input: 'furrfix.desktop', output: '@PLAINNAME@', copy: true, install: enable_installed_tests, install_dir: installed_tests_data_dir / 'share' / 'applications') -+configure_file(input: 'mimeinfo.cache', output: '@PLAINNAME@', copy: true, install: enable_installed_tests, install_dir: installed_tests_data_dir / 'share' / 'applications') diff --git a/pkgs/development/libraries/xdg-desktop-portal/nix-pkgdatadir-env.patch b/pkgs/development/libraries/xdg-desktop-portal/nix-pkgdatadir-env.patch index b099c4ad56f5b..b7ca73e5afedf 100644 --- a/pkgs/development/libraries/xdg-desktop-portal/nix-pkgdatadir-env.patch +++ b/pkgs/development/libraries/xdg-desktop-portal/nix-pkgdatadir-env.patch @@ -1,8 +1,8 @@ -diff --git a/src/portal-impl.c b/src/portal-impl.c -index 85b3a23..6d43636 100644 ---- a/src/portal-impl.c -+++ b/src/portal-impl.c -@@ -275,6 +275,8 @@ load_installed_portals (gboolean opt_verbose) +diff --git a/src/xdp-portal-impl.c b/src/xdp-portal-impl.c +index 770c265..a34ca8e 100644 +--- a/src/xdp-portal-impl.c ++++ b/src/xdp-portal-impl.c +@@ -277,6 +277,8 @@ load_installed_portals (gboolean opt_verbose) /* We need to override this in the tests */ portal_dir = g_getenv ("XDG_DESKTOP_PORTAL_DIR"); diff --git a/pkgs/development/libraries/xdg-desktop-portal/trash-test.patch b/pkgs/development/libraries/xdg-desktop-portal/trash-test.patch index 3bfa885972813..23991fd87020b 100644 --- a/pkgs/development/libraries/xdg-desktop-portal/trash-test.patch +++ b/pkgs/development/libraries/xdg-desktop-portal/trash-test.patch @@ -1,18 +1,18 @@ diff --git a/tests/test_trash.py b/tests/test_trash.py -index d745cd2..173e3e5 100644 +index 2637256..e89d45c 100644 --- a/tests/test_trash.py +++ b/tests/test_trash.py -@@ -24,13 +24,6 @@ class TestTrash: - def test_version(self, portal_mock): - portal_mock.check_version(1) +@@ -13,13 +13,6 @@ class TestTrash: + def test_version(self, portals, dbus_con): + xdp.check_version(dbus_con, "Trash", 1) -- def test_trash_file_fails(self, portal_mock): -- trash_intf = portal_mock.get_dbus_interface() +- def test_trash_file_fails(self, portals, dbus_con): +- trash_intf = xdp.get_portal_iface(dbus_con, "Trash") - with open("/proc/cmdline") as fd: - result = trash_intf.TrashFile(fd.fileno()) - - assert result == 0 - - def test_trash_file(self, portal_mock): - trash_intf = portal_mock.get_dbus_interface() + def test_trash_file(self, portals, dbus_con): + trash_intf = xdp.get_portal_iface(dbus_con, "Trash")