Emacs Client Crashes due to not finding font (but regular emacs works fine) - NixOS

What happened?

I installed the Monoid font (or font-family, whatever) and turned on NixOS’s option to create a font directory under /run/current-system/sw/share/X11/fonts.

This worked at first, but now the screen just flashes white when I try to run emacsclient. Strangely, it still works with just launching emacs. I assume there is some weirdness with what environment variables the client inherits versus full-fat emacs. I haven’t restarted my emacs daemon yet because I am using a NixOS option to run the emacs server by default, so I would need to restart my computer. Will do that after posting.

I have only customised a few keybindings and configured the init.el file Doom ships with.

By the way, I am completely new to emacs, other than using Doom for a short while on my old Fedora (really Nobara) install (until it broke my hybrid graphics after an update, and wouldn’t even boot to tty), and I really liked it.

I only installed NixOS on Saturday. So to summarise, I don’t know emacs well at all and I don’t really understand Nix that well (I understand the language mostly, but how the OS works is another kettle of fish).

(Btw, couldn’t get vterm to work either, so I just used eshell instead.)

Emacsclient output

$ emacsclient -c
Waiting for Emacs...
*ERROR*: Font not available: #<font-spec nil nil Nerd\ Font\ Propo nil nil nil nil nil 16 nil nil nil nil>

System information


Loading data dump...

Update:

Restarting the computer (and thus the emacs server daemon) fixed the issue. I assume the daemon lived on from some earlier configuration state when I was trying to work out how to let emacs see the fonts (this is done with fonts.fontDir.enable in my configuration.nix), or perhaps when I was trying to work out what :family to use (“Monoid Nerd Font”).

Still no sure why it worked for a while before breaking again, but all’s well that ends well.

I wrote this to record it for others who might run into similar font issues between NixOS and emacs.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.