I’m running GNOME on Wayland on NixOS 22.11. I am also running Firefox from Flathub in native Wayland mode (MOZ_ENABLE_WAYLAND=1 set using Flatseal). I can confirm in about:support that Wayland is being used.
Firefox runs fine, but the mouse cursor is often missing, or shows the wrong cursor as I move it around within the Firefox window. If I run Firefox on the command line with flatpak run org.mozilla.firefox, then I see lots of errors being outputted. Some examples:
Gdk-Message: 22:00:51.880: Unable to load sw-resize from the cursor theme
Gdk-Message: 22:00:51.880: Unable to load s-resize from the cursor theme
Gdk-Message: 22:00:51.880: Unable to load se-resize from the cursor theme
Gdk-Message: 22:00:52.125: Unable to load left_ptr from the cursor theme
Gdk-Message: 22:00:52.150: Unable to load nw-resize from the cursor theme
Gdk-Message: 22:00:52.150: Unable to load n-resize from the cursor theme
I’ve done some Googling and tried things like installing Adwaita themes in flatpak (org.gtk.Gtk3theme.adw-gtk3), and installing the gnome.adwaita-icon-theme nix package. Neither of these solved the problem for me.
I confirm that the same Firefox flatpak does not have this problem when running on Fedora Silverblue on the same machine.
Seems like Firefox can’t find the relevant icons in any gtk theme. You probably need to strace Firefox and check where it is searching for gtk themes, then symlink a theme into where the flatpak Firefox is expecting them. For the nixpkgs Firefox, having gnome.adwaita-icon-theme installed in configuration.nix puts things in the right place.
I came across a comment on Reddit that says this is also an issue on Fedora Silverblue (link). Those commentors are using Sway, not GNOME, and personally I do not have issues on Silverblue, but it sounds like this might be a problem in the Firefox flatpak.
No, but for whatever reason the recommendation on how to fix icons is on that page too (adding the .icons directory). That whole section should probably be on the flatpak article, at the moment it just links from the flatpak article to this section.
Feel free to do some wiki maintenance if this bothers you.
Ultimately that page explains the problem and describes the solution though. NixOS doesn’t use standard fhs paths so flatpak lacks permissions for the icons directory.
Personally I still think we need a flatpak module for managing this stuff, but it’s tricky. Flatpak wasn’t designed with declarative config in mind, and mucking with the internals is annoying because they have barely any documentation and often end up behaving weirdly (probably need to update some database somewhere or do some dbus magic).
I’ve noticed a line about .icons, but thought it’s out of place, as the suggested option fonts.fontDir.enable does not create any icons dir, and article doesn’t mention linking that dir from anywhere, and that dir (~/.icons) does not exist by default
so the article is definitely missing something… maybe xdg.icons.enable option? i’ve just looked it up and not sure if it provides icons dir similar to what fonts.fontDir.enable does for fonts
i did add /nix for tests, but it did not affect the result
i’ve also looked at other flatpaks, such as telegram - it has some cursor theme it ships with, not system one, and i could not find those cursors in any of those specified locations, and nothing was binded anywhere outside.
So I consider this to be a bug of how firefox is packed into the flatpak, that it doesn’t come with at least some complete set of cursors.
but as for how to fix it - not sure. i will try binding ~/.local/share/icons a bit later - that’s the only one i haven’t tried yet
TL;DR: I had to enable the xdg-desktop-portal-gtk portal (xdg.portal.extraPackages = [ pkgs.xdg-desktop-portal-gtk ]). I’m using KDE Wayland (whose default portal is xdg-desktop-portal-kde), on NixOS 23.05.