Slow application startup

Newbie here

I installed NixOS a few days ago and I use Sway as my WM. The big problem is that every application has a really long startup time.
Take Nautilus (GNOME File Manager) as an example. It takes ~30-40 seconds to start. Same goes for Firefox, Steam, and pretty much every other program I have installed. This also is the case for flatpak applications.
I suspect it has something to do with the xdg-desktop-portal.

Here are my config files:

And here some program information:

I would be glad for any help or hint you might have. Thank you in advance.

It would be useful to know what kind of hardware you’re running on.

Do you have a persistent .cache/mesa_shader_cache/ directory? Programs require shaders compiling at first start, it can take a while (but certainly not so much time, but this would depend of your specs)

  • AMD Radeon RX6700XT
  • AMD Ryzen 9500X
  • AMD Ryzen 9 3900X
  • 16 GB Ram

I should have. I’m not home right now, I’ll check it out later.
Yes, I have a persistent .cache dir. It contains a mesa_shader_cache directory.

That’s not a real product :stuck_out_tongue: But it doesn’t matter; I was mostly asking in case you were running on either very weird or very old hardware. If that’s not the case then it’s very odd to have this problem.

Yes, I’m stupid. I actually use a 9 3900X :sweat_smile:

I found a temporary solution to this problem.
Where there was

xdg.portal = {
  enable = true;
  wlr.enable = true;
  extraPortals = with pkgs; [

I removed xdg-desktop-portal-gnome.
I now don’t have a desktop portal for GNOME apps (Nautilus, etc.) but applications start as expected. This is kind of weird, because using both desktop portals on Arch worked just fine for me. I will definitely look further into this.
Thank y’all for your replies.

Look in the env vars, IIRC there was a debug var to force portals that would cause insane load times when set.

We even had an option for it but we removed it because of that.

1 Like

I have the exact same issue as op, but I have a much simpler setup. I know sway can work well on this same machine because it did so before I reinstalled with a much simpler set of configs. Where before I had lots of stuff pulled in from gnome manually. This has simplified the config and everything works, except that every single app, including the terminal, takes at least 30 seconds to open. I now just have

    services.xserver = {
      enable = true;
      desktopManager.gnome.enable = true;
      displayManager.gdm.enable = true;

Op’s bandaid fix doesn’t really apply to my config though.

Hey, I have the same problem on Plasma. @faffi did you ever found a fix?

Unfortunately I never found a fix for this problem and after encountering more issues (like Steam games not working correctly) I moved away from NixOS as my desktop operating system. I still love the build system and NixOS is still my linux distro of choice for servers.

Did anybody find a solution to this? I am running NixOS+Hyprland on a laptop with Intel iGPU+NVIDIA dGPU and I often need to wait 3–5 seconds for a terminal (alacritty/kitty) window to launch. After the initial launch, second and third window launches etc. are fine but every once in a while when I want to launch a new window after some time the first terminal window takes inconsistently and annoyingly a long time. I have xdg-desktop-portal-hyprland and xdg-desktop-portal-gtk installed.