Ubuntu with Nix and home-manager: GTK file/save dialogs make applications crash: GDK_PIXBUF env var faulty?

I’m using Nix (not NixOS) on Ubuntu 21 with home-manager to get some applications/services. I noticed that in all GTK applications (for example, firefox), displaying the Open/Save dialog crashes the whole browser. In other words, I cannot save files anymore. These dialogs work if I don’t use ~/.xsession (managed by home-manager) but a regular Ubuntu GNOME session.

I suspected something in the environment was at fault, so I compared both env outputs. If I unset GDK_PIXBUF_MODULE_FILE, everything works again. The variable gets set to /nix/store/7ids0vgrzwdlgaijg0ai7lqk1nnr5nly-librsvg-2.50.7/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache on my machine.

Anyone have a clue what this error might be caused by? What’s this variable and why is it set?

Hello @pimiddy, have you managed to find a solution to this problem? I’m struggling with the same issue. I intend to check if gtk installed apps like firefox installed via nixpkg instead of ubuntu resolves the issue but it’s less than ideal…

Sorry, I haven’t found a solution yet. I’d also appreciate a solution that doesn’t just wrap firefox or something, and works generally.

Today I’ve found ugly hack that seems to work pretty well in my case.

I’m launching almost all applications via rofi and there’s an option to define custom run command.

So I do this:

  rofiRunCommand = pkgs.writers.writeBashBin "rofi-run-command" ''

    exec "$@"

and then

 config.programs.rofi = {
    enable = true;
    extraConfig = {
      run-command = "${rofiRunCommand}/bin/rofi-run-command {cmd}";

This seems to work pretty well.

I’ve also subscribed to Programs using gdk_pixbuf 2.38 crash with 2.36 loaders from system · Issue #54278 · NixOS/nixpkgs · GitHub which looks related.

Hosted by Flying Circus.