From b98f9d8352784c00c4a32cb4a5c06eef1a705f37 Mon Sep 17 00:00:00 2001 From: Rasmus Enevoldsen Date: Wed, 17 Jun 2026 10:07:29 +0200 Subject: [PATCH] xdg-desktop-portal: remove NIX_XDG_DESKTOP_PORTAL_DIR patch xdg-desktop-portal 1.20.1 added support for searching all directories in XDG_DATA_DIRS for portals: https://github.com/flatpak/xdg-desktop-portal/commit/bb37e260db3f91b93227cb559745468922ca29fd This made the NIX_XDG_DESKTOP_PORTAL_DIR patch redundant, since NixOS already ensures /run/current-system/sw/share is on XDG_DATA_DIRS. The patch also does not compose well: it hardcodes a single portal directory, so when both NixOS and home-manager set it, home-manager's value overwrote NixOS's, breaking portal discovery for anything only registered by NixOS (e.g. Cosmic alongside a home-manager-configured Hyprland). --- nixos/doc/manual/release-notes/rl-2611.section.md | 6 ++++++ nixos/modules/config/xdg/portal.nix | 1 - .../xd/xdg-desktop-portal/nix-pkgdatadir-env.patch | 11 ----------- pkgs/by-name/xd/xdg-desktop-portal/package.nix | 5 ----- 4 files changed, 6 insertions(+), 17 deletions(-) delete mode 100644 pkgs/by-name/xd/xdg-desktop-portal/nix-pkgdatadir-env.patch diff --git a/nixos/doc/manual/release-notes/rl-2611.section.md b/nixos/doc/manual/release-notes/rl-2611.section.md index 4dfb4530656b..2b7750602776 100644 --- a/nixos/doc/manual/release-notes/rl-2611.section.md +++ b/nixos/doc/manual/release-notes/rl-2611.section.md @@ -77,6 +77,12 @@ - A number of options for `services.llama-cpp` have been removed in favor of the structured [](#opt-services.llama-cpp.settings) option, attributes from which are used as arguments to `llama-server` executable, you can see all available options by running `llama-server --help`. Configuring model presets using Nix attribute set via `services.llama-cpp.modelsPreset` is no longer supported, please use `services.llama-cpp.settings.models-preset` with a path to an INI file containing desired options. +- The `NIX_XDG_DESKTOP_PORTAL_DIR` environment variable is no longer used in the `xdg-desktop-portal` package and is therefore no longer set in `xdg.portal` module. + Instead the `XDG_DATA_DIRS` environment variable is used to find xdg-portals. + + If you were relying on `NIX_XDG_DESKTOP_PORTAL_DIR` to point at custom portal + definitions, add the package providing them to `xdg.portal.extraPortals`. + - Python 2 has been removed from the top-level package set, as it is long past end-of-life. The `python2`, `python27`, `python2Full`, `python27Full`, `python2Packages`, and `python27Packages` attributes, along with the legacy `python`, `pythonFull`, and `pythonPackages` aliases, now throw an error directing you to `python3`. The `isPy2` and `isPy27` package flags have been removed accordingly. The only remaining Python 2 interpreter is vendored inside the `resholve` package for its `oil` dependency and is not exposed for general use. - `security.polkit.enablePkexecWrapper` has been introduced, making the `pkexec` setuid wrapper opt-in. diff --git a/nixos/modules/config/xdg/portal.nix b/nixos/modules/config/xdg/portal.nix index 6bc6ce5e33e7..78bae2d49995 100644 --- a/nixos/modules/config/xdg/portal.nix +++ b/nixos/modules/config/xdg/portal.nix @@ -150,7 +150,6 @@ in sessionVariables = { NIXOS_XDG_OPEN_USE_PORTAL = mkIf cfg.xdgOpenUsePortal "1"; - NIX_XDG_DESKTOP_PORTAL_DIR = "/run/current-system/sw/share/xdg-desktop-portal/portals"; }; etc = lib.concatMapAttrs ( diff --git a/pkgs/by-name/xd/xdg-desktop-portal/nix-pkgdatadir-env.patch b/pkgs/by-name/xd/xdg-desktop-portal/nix-pkgdatadir-env.patch deleted file mode 100644 index 369dd2a860f1..000000000000 --- a/pkgs/by-name/xd/xdg-desktop-portal/nix-pkgdatadir-env.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- 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"); -+ if (portal_dir == NULL) -+ portal_dir = g_getenv ("NIX_XDG_DESKTOP_PORTAL_DIR"); - if (portal_dir != NULL) - { - diff --git a/pkgs/by-name/xd/xdg-desktop-portal/package.nix b/pkgs/by-name/xd/xdg-desktop-portal/package.nix index fc618622942a..32c369a0e4a6 100644 --- a/pkgs/by-name/xd/xdg-desktop-portal/package.nix +++ b/pkgs/by-name/xd/xdg-desktop-portal/package.nix @@ -76,11 +76,6 @@ stdenv.mkDerivation (finalAttrs: { # Allow installing installed tests to a separate output. ./installed-tests-path.patch - # Look for portal definitions under path from `NIX_XDG_DESKTOP_PORTAL_DIR` environment variable. - # While upstream has `XDG_DESKTOP_PORTAL_DIR`, it is meant for tests and actually blocks - # any configs from being loaded from anywhere else. - ./nix-pkgdatadir-env.patch - # test tries to read /proc/cmdline, which is not intended to be accessible in the sandbox ./trash-test.patch ];