NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.59k stars 13.74k forks source link

xdg-desktop-portal-gtk is broken when installed alongside gnome and used outside of gnome #334260

Open clanktron opened 1 month ago

clanktron commented 1 month ago

Describe the bug

When gnome is installed via services.xserver.desktopManager.gnome.enable it installs xdg-desktop-portal-gnome and xdg-desktop-portal-gtk. However it passes an override flag to the gtk portal to disable a number of interfaces that are instead provided by the gnome portal.

https://github.com/NixOS/nixpkgs/blob/6cbec70756cb7de1542f668a3807ca7808f62547/nixos/modules/services/x11/desktop-managers/gnome.nix#L284-L290

https://github.com/NixOS/nixpkgs/blob/6cbec70756cb7de1542f668a3807ca7808f62547/pkgs/development/libraries/xdg-desktop-portal-gtk/default.nix#L45-L50

This is fine if you're only using gnome. However if you're relying on the gtk portal for other window mangers/DE (any/all gnome/gtk4 apps use such), then the gtk portal can only provide a small subset of its intended functionality (missing settings, online accounts, etc).

I'm not sure if the gtk portal and gnome portal will have conflicts when the disabled flags are removed. If they do, then the user would need two gtk portals (one with the disabled flags that'll only run under gnome, and another with everything enabled that should run under other window managers/DE). If anyone has extra insight on this I'm all ears.

Steps To Reproduce

Steps to reproduce the behavior:

  1. enable gnome in configuration.nix
  2. have another DE/window manager installed
  3. boot to said other DE/window manager and attempt to use any gtk4 or gnome-reliant apps

Expected behavior

GTK4/Gnome apps should have access to online accounts, dark mode preferences, etc.

Additional Context

Metadata

[I] clayton@nixos ~ [1]> nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.6.44, NixOS, 24.05 (Uakari), 24.05.3690.21cc704b5e91`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.5`
 - channels(root): `"nixos-24.05"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

herrwiese commented 19 hours ago

I have a similar issue, where Plasma6 recently adds xdg-desktop-portal-gtk (without override flag). When Gnome is also enabled, this causes build failures because now building user-units tries to create an xdg-desktop-portal-gtk.service symlink to both variants of xdg-desktop-portal-gtk. -.-