Fonts Broke after 25.05 Update

I updated my nixos to 25.05 but now some of my fonts are broken and i have no what it causing it.


My nixos config: linuxchr/nix - Codeberg.org

I also have following error when starting alacrity:
Created log file at “/tmp/Alacritty-6905.log”
[0.043873057s] [ERROR] [alacritty] Cannot open resource
Deleted log file at “/tmp/Alacritty-6905.log”
Error: Font(PlatformError(“Cannot open resource”))

3 Likes

Hi,
I also had issue with the font change in 25.05

What solved it for me was to be on 24.11, then do a nixos-rebuild boot instead of nixos-rebuild switch
Other solution that might work for you is to do sudo fc-cache -rv + reboot/logout

After looking at your repo, I only see one thing that seems weird:

Why are you getting all nerd-fonts and not only the one you use?
Here is my home-manager config in comparison: nixconf/user/alex/home/font/default.nix at 4356803c8499001cbb2d419114d3c6f9f3d2043d · Alexdelia/nixconf · GitHub

Here is my merge commit with all changes between 24.11 and 25.05 Merge pull request #5 from Alexdelia/25.05 · Alexdelia/nixconf@4356803 · GitHub

I figured out the line causing the problem:

monospace = {
        package = pkgs.nerd-fonts.jetbrains-mono;
        name = "JetBrainsMono Nerd Font";
      };

It is in Making sure you're not a bot!

When having it in the config my fonts break when not everything works, but if i remove the line i no longer have my fonts set to JBM Nerd Font of course. It probably has something to do with stylix.

you can do fc-list to list your available fonts

also, you are still using

stylix.url = "github:danth/stylix/release-25.05";

you might want to use

stylix.url = "github:nix-community/stylix/release-25.05";

it shouldn’t be the root cause of the font issue

Already did, JetBrainsMono Nerd Font is listed there. Cant paste output as i did it with Strg+ALT+F2 as my terminal broke with the update.

Extra tip

I also have following error when starting alacrity:
Created log file at “/tmp/Alacritty-6905.log”
[0.043873057s] [ERROR] [alacritty] Cannot open resource
Deleted log file at “/tmp/Alacritty-6905.log”
Error: Font(PlatformError(“Cannot open resource”))

I had the same issue with alacritty, it got solved the same way

To get more info, you can do alacritty -vvv

Currently use an alternative terminal with working fonts:
Opening with nvim over neovide. Running :terminal

Alacritty log:

[0.022817072s] [INFO ] [alacritty] Window scale factor: 1
[0.024096267s] [DEBUG] [alacritty] Loading "JetBrainsMono Nerd Font" font
[0.045498448s] [TRACE] [crossfont] Number of fonts is 45
[0.045523156s] [TRACE] [crossfont] Got font path="/home/christian/.nix-profile/share/fonts/truetype/NerdFonts/JetBrainsMonoNerdFont-Regular.ttf", index=0
[0.045543363s] [ERROR] [alacritty] Cannot open resource
[0.050937899s] [TRACE] [crossfont] Number of fonts is 45
[0.050961167s] [TRACE] [crossfont] Got font path="/home/christian/.nix-profile/share/fonts/truetype/NerdFonts/JetBrainsMonoNerdFont-Regular.ttf", index=0
[0.051788374s] [INFO ] [alacritty] Goodbye
Deleted log file at "/tmp/Alacritty-3484.log"
Error: Font(PlatformError("Cannot open resource"))

Now i can remove the before mentioned stylix lines and my fonts stays on JBM. But i still want to have this stylix line.

I’m sorry, I do not know how to solve this issue in your situation

The issue home-manager/issues/7098 indicate that fc-match changed behavior in home-manager:

I wonder if it’s related and a nix flake update without more tinkering of your config would solve your issue

I really hope that you find a solution, for you and everyone that will have the same problems.

nix flake update, it did this some many times that i have hit the github rest api limit.

1 Like

Apparently, another solution might be to:

FWIW, manually removing ~/.cache/fontconfig and re-running fc-cache -vr finally cleared the issue up for me.

in your case, you might want to see where ~/.nix-profile/share/fonts leads to and maybe removing it before a nixos-rebuild boot

I wish you luck and I won’t hesitate to answer more if I find more

4 Likes

Also fixed it for me, thanks for helping

4 Likes

I was in the same boat and just running fc-cache -vr fixed it for me (and after restarting affected apps of course).

Fonts broke with me too. Particularly rofi and fixed width in Firefox. Appears all uppercase. So far the work arounds mentioned above, e.g. deleting/recreating the cache has not helped.

Work around for me is to remove font-awesome from home.packages in home-manager.

At least it works for Firefox and rofi. Sway is still bad, but I haven’t restarted that yet. I imagine it should come good after restarting.

I just had the issue on arm M1 fedora asahi with home-manager

only had to do

rm -rf ~/.cache/fontconfig/
sudo fc-cache -rv

and it was fixed

didn’t need to reboot or logout for alacritty and other programs to work right away