Need help setting TTY font

Howdy!

I having issues getting the TTY font properly configured on my laptop. Specifically, I have the following in my nixos configuration (similar to what is mentioned here).

console = {
  earlySetup = true;
  packages = with pkgs; [ terminus_font ];
  font = "${pkgs.terminus_fonts}/share/consolefonts/ter-u28n.psf.gz";
};

Rebuilding the configuration seems to work, but it does not seem that the font is changed (even after reboot). No matter which font I set, it remains much too small :frowning:

Thanks,
smkuehnhold

1 Like

For the font attribute in console only the name of the specific font variant is needed, not the path. When the packages are included, it handles the path setup so any of the included variants can be selected by name.

console = {
  earlySetup = true;
  packages = with pkgs; [ terminus_font ];
  font = "ter-u28n";
};

I think that should work for you.

2 Likes

Consider trying kmscon, which lets you resize the font with Ctrl+Plus/Minus and use regular system fonts instead of terminal fonts. It also supports scrollback with shift+pageup/down, which was removed from the default Linux TTY.

3 Likes

Even after making these changes, it still does not seem to work. The font remains the same as the default.

I just tested this in a VM on NixOS 21.05 and unstable (provided you fix terminus_fontsterminus_font) and it worked.

1 Like

It’s possible I assumed the name format incorrectly, I’m personally using the powerline variants of the terminus fonts. This setup has been working for me for qute some time:

  console = {
    font = "ter-powerline-v24b";
    packages = [
      pkgs.terminus_font
      pkgs.powerline-fonts
    ];
  };

On a different machine I no longer have, I had the non-powerline version working without the path, but i don’t have that history available. But I recal having to dig deeply into this to figure out how it worked.

@ryantm’s suggestion seems pretty pretty interesting, might give that a shot myself.

3 Likes

Interesting. But last commit was in 2014 https://cgit.freedesktop.org/~dvdhrm/kmscon/log/

Edit: from KMSCON - ArchWiki

The patched version, along with its patched dependency (libtsm-patched-gitAUR), includes fixes and improvements (like 24-bit color support) that the canonical version (which has not been updated since 2014) does not.

And the repo of patched kmscon:

1 Like

I appreciate you verifying things on your end. It’s very possible/likely that I am misunderstanding something or have a bug in my configuration. Do you know a way to verify which font is being used on my end (other than visually)?

Uhm, I don’t think the Linux virtual terminal holds that kind of information. You could try to directly set the font:

setfont $(nix-build '<nixpkgs>' --no-out-link -A terminus_font)/share/consolefonts/ter-u28n.psf.gz
2 Likes

Not sure why, but upgrading to 21.11 seems to have fixed the issue?

1 Like