Retroarch runs from Emacs, but not from terminal

On NixOS 25.11, I installed retroarch using home-manager’s programs.retroarch option, and I could use some help fixing why it won’t run from the app launcher.

On Gnome, it doesn’t launch from the app launcher. When I try running retroarch from the terminal, I get an error. And when I open a shell from Emacs and enter retroarch, I can run it no problem.

Here’s the error output I get when run from the terminal:

$ retroarch
(retroarch:10407): GLib-GIO-ERROR **: 05:38:26.276: Settings schema 'org.gtk.Settings.ColorChooser' is not installed
Trace/breakpoint trap      (core dumped) retroarch

Then, I see that I can’t find org.gtk.Settings.ColorChooser in the terminal:

$ gsettings list-schemas | grep gtk
org.gtk.Demo4
org.gtk.gtk4.Inspector.Recorder
org.gtk.gtk4.Settings.ColorChooser
org.gtk.gtk4.Settings.Debug
org.gtk.gtk4.Settings.EmojiChooser
org.gtk.gtk4.Settings.FileChooser

And running the same command in Emacs, the environment in Emacs has org.gtk.Settings.ColorChooser:

$ gsettings list-schemas | grep gtk
org.gtk.Demo
org.gtk.Demo4
org.gtk.Settings.ColorChooser
org.gtk.Settings.Debug
org.gtk.Settings.EmojiChooser
org.gtk.Settings.FileChooser
org.gtk.exampleapp
org.gtk.gtk4.Inspector.Recorder
org.gtk.gtk4.Settings.ColorChooser
org.gtk.gtk4.Settings.Debug
org.gtk.gtk4.Settings.EmojiChooser
org.gtk.gtk4.Settings.FileChooser

Any ideas? I tried installing Retroarch as a system package, and tried installing gtk3 and gsettings-desktop-schemas in both NixOS and Home-Manager to try to get org.gtk.Settings.ColorChooser in my envrionment.

Sounds like a packaging mistake to me, or perhaps you’re using the wrong retroarch package. Can you share your config?

Firstly, though, let’s explain the weird behavior. It boils down to environment variables.

The very big lesson to take away from this is this: Unless someone made a mistake, installing something “globally” is pointless on NixOS. This is to ensure that two packages can depend on different versions of the same library without interfering with one another. This extends to gsettings schemas.

For gsettings schemas specifically, they are read from XDG_DATA_DIRS. Each package that depends on gsettings schemas is “wrapped” so that directories with the schemas it needs are prepended to that variable.

Emacs is generally built with the gtk front-end, so emacs is wrapped with gsettings schemas. Since environment variables propagate, the schemas bundled with emacs are inherited by retroarch, and emacs just so happens to contain the schemas it needs.

Your gnome environment, being gtk4, is not wrapped with these gtk3 schemas, and hence retroarch doesn’t erroneously inherit the schemas.

What should be happening is that retroarch is wrapped with its own set of schemas (so that each package can work independently and use different versions of the same schema). This appears to be true given the derivation, but I don’t know what you’re using.

2 Likes

Update to latest 25.11, shoud be fixed by [Backport release-25.11] retroarch: add wrapGAppsHook3 by nixpkgs-ci[bot] · Pull Request #468109 · NixOS/nixpkgs · GitHub

1 Like

That certainly explains why the package looks like it should be working…

Thanks for the help - updating my NixOS flake fixed the issue :tired_face:

@TLATER, thanks for the excellent explanation of what was happening between Emacs and the terminal regarding environment variables. This was pointing to what I was suspecting - an issue with the derivation…which would’ve easily been fixed by updating to the latest 25.11…

For completeness, here’s a link to my configuration before updating. dotfiles/modules/gaming.nix at bbc53b7dcd04205b375a17ffadd74eab0a91b33e · jstamant/dotfiles · GitHub

The package I was using was retroarch-bare, which was the default for the home-manager option.

1 Like