How to changing TTY keyboard layout?


#1

I’m trying to customize the keyboard RU layout in the console. But it does not work in the terminal (for example tty2,3,4). Works only for X terminal.

xserver = {
  enable = true;
  layout = "us,ru";
  xkbOptions = "caps:swapescape,grp:rctrl_rshift_toggle";
};

Could you specify settings for TTY layout


#2

I think that is what the consoleKeyMap option is for:
https://nixos.org/nixos/options.html#i18n.consolekeymap


#3

I use i18n.consoleUseXkbConfig (for TTY to use the same settings).

e.g.,

{
  services.xserver.layout = "us,ua";
  services.xserver.xkbVariant = "workman,";

  # Use same config for linux console
  i18n.consoleUseXkbConfig = true;
}

#4

Works for me, Thanks!