nixpkgs/pkgs/development/libraries/xdg-desktop-portal/separate-env-for-portal-config.patch
Bobby Rong e2ad581c95 xdg-desktop-portal: 1.17.0 → 1.17.2
https://github.com/flatpak/xdg-desktop-portal/compare/1.17.0...1.17.2

meson changes look okay.

- Improvements to the new config-based portal matching mechanism. Config files
  are now searched in standard paths, in a way that is compatible to other
  system components (e.g. MIME types).

e7027b7bcc

Our NixOS module will depend on the changes here.

Changelog-reviewed-by: Bobby Rong <rjl931189261@126.com>
Changelog-reviewed-by: Jan Tojnar <jtojnar@gmail.com>
2023-11-21 08:42:10 +01:00

33 lines
1.1 KiB
Diff

diff --git a/src/portal-impl.c b/src/portal-impl.c
index 0fa9682e..99f379dc 100644
--- a/src/portal-impl.c
+++ b/src/portal-impl.c
@@ -433,8 +433,7 @@ load_portal_configuration (gboolean opt_verbose)
desktops = get_current_lowercase_desktops ();
- /* We need to override this in the tests */
- portal_dir = g_getenv ("XDG_DESKTOP_PORTAL_DIR");
+ portal_dir = g_getenv ("NIXOS_XDG_DESKTOP_PORTAL_CONFIG_DIR_OVERRIDE");
if (portal_dir != NULL)
{
@@ -464,6 +463,18 @@ load_portal_configuration (gboolean opt_verbose)
if (load_config_directory (SYSCONFDIR "/" XDP_SUBDIR, desktops, opt_verbose))
return;
+ portal_dir = g_getenv ("NIXOS_XDG_DESKTOP_PORTAL_CONFIG_DIR");
+
+ if (portal_dir == NULL)
+ /* We need to override this in the tests */
+ portal_dir = g_getenv ("XDG_DESKTOP_PORTAL_DIR");
+
+ if (portal_dir != NULL)
+ {
+ if (load_config_directory (portal_dir, desktops, opt_verbose))
+ return;
+ }
+
/* $XDG_DATA_HOME/xdg-desktop-portal/(DESKTOP-)portals.conf
* (just for consistency with other XDG specifications) */
g_clear_pointer (&user_portal_dir, g_free);