Proper way to support unicode in ttys on NixOS?


I’m new to NixOS (and seriously loving it). I’m facing an issue where my ttys (eg from Ctrl+Alt+f1) are unable to properly print unicode characters. I found a solution and am making this post because (1) I’m not sure if my solution is proper; and (2) for the benefit of future Googlers.

My solution was to make the following changes to configuration.nix:

environment.interactiveShellInit = ''
  grep -q /dev/tty <(tty) && exec fbterm
security.wrappers.fbterm = {
  setuid = true;
  owner = "root";
  group = "root";
  source = "${pkgs.fbterm}/bin/fbterm";

This works, but I have some concerns. First, I wonder if setting uid on fbterm like this is a security risk. Some cursory testing suggests that it’s not, but I’m not confident. Second, I wonder if grep -q /dev/tty <(tty) && exec fbterm is sufficiently shell-independent to be used in interactiveShellInit. It seems to work on sh, which suggests yes. Finally, I wonder if there’s a better way to place the shell code than interactiveShellInit (or if there’s a better way to solve this problem altogether).

(nb. I recognize that grep and tty are undocumented dependencies for this, but I figure it’s reasonable to assume that a NixOS system has them in PATH)

Any feedback is appreciated!

if fbterm itself is not a hard requirement, there is the services.kmscon alternative.


Hey, I didn’t see that. Useful, thank you!

Could you elaborate on KMSCON? How is the relation to Gnome Terminal?

There is no relation. Gnome terminal runs in a graphical session of some kind. kmscon is meant to be a richer alternative to the built in linux framebuffer console (the terminal you get when VT switching with the ctrl+alt+F* keys)