If you have problem with fonts,
if this are built-in fonts, make sure the name is correct by going into /etc/kbd/consolefonts, and doing
ls -1 /etc/kbd/consolefonts |sort |less
and verifying
setfont $yourfontname
is loading the font correcty. If it does, you can apply it into configuration.nix:
console.font="$yourfontname"
If font is not built-in, you need to link it in configuration.nix (here for terminus font):
console.packages=[ pkgs.terminus_font ];
console.font="${pkgs.terminus_font}/share/consolefonts/ter-i22b.psf.gz";
Then you need to check if font is loaded by checking console service after the reboot:
systemctl status systemd-vconsole-setup
If the service failed, then there was a problem with file name or problem with font decompressor.
If the service has not failed, but font is still not loaded, then the issue is with a race condition between font and videodriver: fontconfig will load the font bitmap into video memory. Reloading a videodriver will clean the memory and cause fontconfig reset. Currently the video driver is stored in kernel - it can either be built-in or stored as module to be loaded on demand. This driver stays dormant, unless explicitly loaded by user or loaded by xorg/wayland. The problem is that Xorg/Wayland start late on the list - thus the font gets applied near start and then driver load causes the changes to be reset.
First read current kernel configuration to find out how your videodriver is inserted into kernel (use “/searchstring” to lookup (CASE sensitive) and “n” to find next match, arrows+home to navigate, q to quit):
zcat /proc/config.gz |less
or feed it into grep:
zcat /proc/config.gz | grep -i $driver
“y” means its built-in, “m” built into initramfs as module and “n” not built.
Now, you have a videodriver in xorg or wayland (here for example amdgpu):
services.xserver.enable=true;
services.xserver.videoDrivers=["amdgpu"];
and this driver (amdgpu) is built as module (“m”) in kernel, then you need to add it to kernel to prevent reloading during start of Xorg, so its loaded straight away, before vconsole setup does font changes.
boot.initrd.kernelModules=["amdgpu"];
When xorg/wayland start, there will be no driver reload.
Another solution would be to force-set the font twice - on systemd start and after xorg/wayland started.