console.keyMap = "custom"; How to?

I use nixos without a window manager or GUI, in console mode. I use a modified console keymap called .

How can I make it so this can live in the nix store natively, and can be loaded and referenced normally with console.keyMap = "dvorak-custom"; ?

You can see below my attempts at this have been commented out:

  # environment.etc."kbd/keymaps/i386/dvorak/".text builtins.readFile /home/a/.local/;

  #environment.etc = {
  #  "kbd/keymaps/i386/dvorak/".source = /home/a/.local/;

  console = {
    font = "Lat2-Terminus16";
    keyMap = "dvorak";
    # keyMap = "dvorak-custom";  # want something like this here. The above environment.etc attempts do not work

Since I’ve been unsuccessful in making the dvorak-custom map be resident in the nixos store, I’ve resigned myself to logging in and running sudo loadkeys /home/a/.local/ , but this is not ideal for me. I want to have the dvorak custom map be a part of my configuration and nixos.

I’ve also tried:

  console = {
    font = "Lat2-Terminus16";
    keyMap = "/home/a/.local/";

which also wasn’t successful.

Is there a way to achieve this?

Did you try making keyMap a path instead of a string (lose the quotes)? I don’t know if that’ll work, but the documentation says it can be a string or a path.

Otherwise, the option console.packages is how you add more keymaps to be chosen from by name. You’d need to make a trivial package that sticks your keymap file in the right location—somewhere under share/keymaps, I expect.

1 Like

Cool! That worked!

  console = {
    font = "Lat2-Terminus16";
    keyMap = /home/a/.local/;

I’ll investigate console.packages for a more complete solution, but the above works for now. Thank you!