Settings for increasing text-mode font size

In text mode, the text looks tiny on my HiDPI screen. Which settings can be used to increase the text mode font size? I tried setting i18n.consoleFont to Lat2-Terminus16 and Lat2-Terminus32 respectively but they both look the same at the login prompt, even after a reboot. I think it’s because Lat2-Terminus32 does not exist. The kbd package has a /share/consolefonts/Lat2-Terminus16.psfu.gz but that’s the only size available.

So, I have 2 questions:

  • Why does nixos-rebuild not complain when I try to use a non-existent font? I suppose the answer is that the check is done by some low-level program and NixOS current job is to just pass the font name to it?
  • How do I actually double the font size on my system, which is currently using Lat2-Terminus16? There’s the terminus_font package, but I don’t know what to make of the multiple files in it with weird names like ter-u32n.psf.gz and ter-v32b.psf.gz.

This is a sample nixos-rebuild log where no error or warning is output:

building Nix...
building the system configuration...
these derivations will be built:
  /nix/store/ji4jj23nb71xx4hhl106z18xpxm2nbdm-vconsole.conf.drv
  /nix/store/0bh2j8bgi7pp2ry6yrbfnbp5bj6glwhs-unit-systemd-vconsole-setup.service.drv
  /nix/store/7638ab8cs453z1simdmjhwzcpyf5ls9x-system-units.drv
  /nix/store/cinn51k9lbmsrq4b0a5j8la5hl7d7ijg-etc.drv
  /nix/store/mmgvsv15bdz4dd98fyr8k8589b5dkbam-nixos-system-sauron-19.03.172422.915ce0f1e1a.drv
building '/nix/store/ji4jj23nb71xx4hhl106z18xpxm2nbdm-vconsole.conf.drv'...
building '/nix/store/0bh2j8bgi7pp2ry6yrbfnbp5bj6glwhs-unit-systemd-vconsole-setup.service.drv'...
building '/nix/store/7638ab8cs453z1simdmjhwzcpyf5ls9x-system-units.drv'...
building '/nix/store/cinn51k9lbmsrq4b0a5j8la5hl7d7ijg-etc.drv'...
building '/nix/store/mmgvsv15bdz4dd98fyr8k8589b5dkbam-nixos-system-sauron-19.03.172422.915ce0f1e1a.drv'...
activating the configuration...
setting up /etc...
reloading user units for jchia...
setting up tmpfiles

journalctl tells me that setfont failed in systemd-vconsole-setup. When I manually run setfont with the full pathname of ter-v32n.psf.gz, it works. But, it appears that consoleFont is not expecting a pathname. setfont --help indicates that it looks for font files specially in /share/*/ of the kbd nix store directory.

No real answer to your questions, but this works for me on a 4k screen:

i18n = {
    consoleFont = "latarcyrheb-sun32";
    # ...
};
2 Likes

Can’t answer the first point… but have you added the font package to i18n.consolePackages?

Try the following:

i18n.consoleFont = "ter-i32b";
i18n.consolePackages = with pkgs; [ terminus_font ];

Also, this sets the font size much earlier in the boot process:

boot.earlyVconsoleSetup = true;
4 Likes

Thanks, that just worked. I also didn’t have to list the terminus_font package in environment.systemPackages. I just had to put it in consolePackages.

1 Like

The options have been renamed. The complete “new” code is:

  console.font = "ter-i32b";
  console.packages = with pkgs; [
    terminus_font
  ];