I’m adding Nix integration into Emacs. I want to install fonts. Emacs apparently uses system fonts and doesn’t accept custom paths. In that case, I need to tell the system profile about some fonts, even if Emacs installs them into a custom profile.
What approaches would enable Emacs to have fonts it installs into a custom profile get picked up in the normal flow for fonts installed via, for example, home manager into ~/.nix-profile?
I’m not sure if its what you are asking, but if it is, you can make Emacs use more font directories by setting the FONTCONFIG_FILE environment variable to a fontconfig file that includes those directories.
In my config I use makeWrapper to set the variable to use a fontconfig file with custom fonts generated with makeFontsConf (see https://github.com/accelbread/config-flake/blob/a62bf31bdaa14a5240fdf48ca83b00a448749d77/nix/packages/emacsAccelbread.nix#L113).
Thanks. This is helpful. IIRC home manager has to solve this problem as well.
Do I need to run a program after updating that variable / installing fonts into the location it points to?
When Emacs loads fontconfig it uses that variable. You’ll either need to set it before running Emacs or set it before fontconfig is initialized. Setting it in early-init.el might work?