Doom Emacs GUI segfault on NixOS 25.05 with GLib GSettings error; gsettings list-schemas shows none
Summary
- Doom Emacs GUI segfaults at startup with GLib/GSettings critical error.
emacs -Q(GUI) works;emacs -nw(terminal) works; only Doom GUI crashes.- In my shell,
gsettings list-schemasinitially prints “No schemas installed”. - If I craft
XDG_DATA_DIRSfrom store schema roots,gsettingslists many schemas, but Doom GUI still segfaults.
System
- Timestamp / kernel:
2025-10-25T03:32:26-03:00—Linux mantis 6.16.12 #1-NixOS x86_64 - NixOS:
25.05.811621.c8aa8cc00a5c (Warbler) - Nix:
nix (Nix) 2.28.5 - Desktop: KDE Plasma
6.3.6; Qt:6.9.2 - Emacs:
GNU Emacs 30.0.92
Batch probe:build: x86_64-pc-linux-gnu, window-system: nil
(Unsure if my GUI build is GTK3 or PGTK; it’s from/nix/store/...-emacs-30.0.92/bin/emacs.) - GLib/GSettings tools in PATH:
gsettings: N/A,glib-compile-schemas: N/A
(There areglib-compile-schemasbinaries in the store dev outputs.)
Nix channels / profiles (relevant)
- Channel:
nixpkgs https://nixos.org/channels/nixpkgs-unstable - nix profile list (selected):
glib→/nix/store/ji3yqx69...-glib-2.84.4-bingsettings-desktop-schemas→/nix/store/03iq7iqv9...-gsettings-desktop-schemas-48.0home-manager-pathpresent
- Registry: includes
emacs-overlay,home-manager,nixpkgs-unstable, etc. (full list available)
Symptoms
Launching Doom Emacs GUI:
$ emacs --debug-init
Loading ~/.emacs.d/lisp/doom.el ...
* ... ~/.config/doom/init.el t
(process:XXXXX): GLib-GIO-CRITICAL **: g_settings_schema_source_lookup: assertion 'source != NULL' failed
Fatal error 11: Segmentation fault
Backtrace:
... /nix/store/...-emacs-30.0.92/bin/emacs() ...
... glibc-2.40-36/lib/libc.so.6 ...
Segmentation fault (core dumped)
What works:
emacs -Q(GUI) starts fine.emacs -nw(Doom in terminal) starts fine.
What fails:
emacs(Doom GUI) segfaults early in init.
GSettings state
Baseline:
$ gsettings list-schemas | head
No schemas installed
Tried pointing to various gschemas.compiled from FHS envs (Steam/AppImage) — sometimes -Q starts, but Doom still crashes.
I then collected non-FHS schema roots:
$ find /nix/store -type d -path '*/share/gsettings-schemas/*' | head
/nix/store/b3d6...-gtk4-4.16.12/share/gsettings-schemas/gtk4-4.16.12
/nix/store/nz0b...-ibus-1.5.30/share/gsettings-schemas/ibus-1.5.30
/nix/store/nil2...-gnome-settings-daemon-47.2/share/gsettings-schemas/gnome-settings-daemon-47.2
...
Built XDG_DATA_DIRS from those /share roots (+ gsettings-desktop-schemas-48.0/share):
$ XDG_DATA_DIRS="<many /nix/store/.../share:>:$XDG_DATA_DIRS" gsettings list-schemas | head
org.freedesktop.pulseaudio.module-groups
org.gnome.desktop.a11y
org.gnome.desktop.interface
... (many)
Yet:
$ XDG_DATA_DIRS="..." emacs --debug-init
... still segfaults with the same GLib-GIO-CRITICAL and backtrace
I also attempted a user-local union of schema XMLs in ~/.local/share/glib-2.0/schemas and compiling gschemas.compiled, but I initially lacked a reliable glib-compile-schemas in PATH and didn’t complete a clean compile.
What changed recently
- Running Plasma 6.3.6 on NixOS 25.05; I keep my system and HM updated.
- I have
gsettings-desktop-schemas-48.0in my user profile vianix profile. XDG_DATA_DIRSis large with many KDE/Qt paths; noglib-2.0/schemason it by default.
Repro steps
emacs -Q→ works (GUI).emacs -nw→ works (Doom in terminal).emacs(Doom GUI) → GLib-GIO-CRITICAL then segfault.gsettings list-schemas→ No schemas installed (baseline shell).- Export
XDG_DATA_DIRSto include/nix/store/*/share/gsettings-schemas/*/glib-2.0/schemasparent dirs (plusgsettings-desktop-schemas-48.0/share) →gsettingslists schemas, butemacs(Doom GUI) still segfaults.
Hypothesis
Emacs GUI build (GTK/PGTK) isn’t wrapped with the expected gapps environment, so GLib lacks a default GSettings schema source. Doom likely touches GSettings early (theme or interface), triggering the crash. -Q avoids the code path; -nw avoids GTK entirely.
Questions for NixOS folks
-
Which Emacs package/derivation should I use to ensure a proper gapps-wrapped GTK/PGTK Emacs on NixOS 25.05 (Warbler)?
- e.g., should I switch to a specific
pkgs.emacs30*variant oremacsPgtkfromemacs-overlay, or use a Nix-provided wrapper?
- e.g., should I switch to a specific
-
Is there a recommended way to make GSettings schemas discoverable system-wide (or per-user) without manual
XDG_DATA_DIRSsurgery?- Via
environment.systemPackages+wrapGAppsHook, orprograms.emacsmodule? - Any
home-manageroptions to setXDG_DATA_DIRS/GSETTINGS_SCHEMA_DIRto the Nix “relocated” paths?
- Via
-
If the root cause is Doom calling into GSettings at init, is there a known Doom-side workaround (env vars or disabling auto GTK/gnome integration) that avoids the crash?
Thanks in advance! Happy to test any wrapper or configuration patches. ![]()