nixpkgs/pkgs/development/libraries/xdg-desktop-portal/nix-pkgdatadir-env.patch
Jan Tojnar 3b2f55e89f xdg-desktop-portal: Use custom variable for finding portals
x-d-p only looks for portal definitions in one of two places:
- datadir (which we cannot install anything to, since Nix packages are immutable)
- when `XDG_DESKTOP_PORTAL_DIR` environment variable is set, the path specified therein
  (meant for tests, disables looking for portal configuration anywhere else)

Let’s introduce our own `NIX_XDG_DESKTOP_PORTAL_DIR` environment variable
that will only control the portal definitions lookup.
We will not use it for searching for configuration
because it would require looking in the parent directory
and `XDG_CONFIG_DIRS` variable is sufficient for us.
2024-02-11 03:21:55 +01:00

13 lines
469 B
Diff

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)
/* We need to override this in the tests */
portal_dir = g_getenv ("XDG_DESKTOP_PORTAL_DIR");
+ if (portal_dir == NULL)
+ portal_dir = g_getenv ("NIX_XDG_DESKTOP_PORTAL_DIR");
if (portal_dir == NULL)
portal_dir = DATADIR "/xdg-desktop-portal/portals";