Failing to start xdg-desktop-portal-gnome after logging on Gnome

I’m using NixOS Unstable with Gnome (Wayland) and NVidia proprietary driver. In my config I have enabled xdg-portal and since I use Gnome the xdg-portal used is the gnome one (xdg-desktop-portal-gnome). But when I log into Gnome Systemd tries to start xdg-desktop-portal-gnome but it fails with this error:

❯ journalctl --user -u xdg-desktop-portal-gnome.service -b
dez 13 17:03:48 watchmen systemd[2177]: Starting Portal service (GNOME implementation)...
dez 13 17:03:48 watchmen .xdg-desktop-po[2461]: cannot open display: 
dez 13 17:03:48 watchmen systemd[2177]: xdg-desktop-portal-gnome.service: Main process exited, code=exited, status=1/FAILURE
dez 13 17:03:48 watchmen systemd[2177]: xdg-desktop-portal-gnome.service: Failed with result 'exit-code'.
dez 13 17:03:48 watchmen systemd[2177]: Failed to start Portal service (GNOME implementation).

If I restart the xdg-desktop-portal-gnome:

systemctl restart --user xdg-desktop-portal-gnome.service

It starts correctly:

❯ systemctl status --user xdg-desktop-portal-gnome.service
● xdg-desktop-portal-gnome.service - Portal service (GNOME implementation)
     Loaded: loaded (/etc/systemd/user/xdg-desktop-portal-gnome.service; static)
     Active: active (running) since Tue 2022-12-13 17:14:11 -03; 1min 5s ago
   Main PID: 5041 (.xdg-desktop-po)
      Tasks: 4 (limit: 57700)
     Memory: 8.3M
        CPU: 99ms
     CGroup: /user.slice/user-1000.slice/user@1000.service/app.slice/xdg-desktop-portal-gnome.service
             └─5041 /nix/store/qxsxkmsck793lhfl62qy5zarb7wymwxx-xdg-desktop-portal-gnome-43.1/libexec/xdg-desktop-portal-gnome

dez 13 17:14:11 watchmen systemd[2177]: Starting Portal service (GNOME implementation)...
dez 13 17:14:11 watchmen systemd[2177]: Started Portal service (GNOME implementation).

The problem is Firefox and other apps are taking a lot of time to start the first time. If I restart xdg-desktop-portal-gnome before start firefox the first time, it starts quickly.

Created a bug report Failing to start xdg-desktop-portal-gnome after logging on Gnome · Issue #206630 · NixOS/nixpkgs · GitHub