···
keyboard layouts using the option
+
<option><link linkend="opt-services.xserver.extraLayouts">
+
services.xserver.extraLayouts</link></option>.
As a first example, we are going to create a layout based on the basic US
layout, with an additional layer to type some greek symbols by pressing the
+
Create a file called <literal>us-greek</literal> with the following
+
content (under a directory called <literal>symbols</literal>; it's
+
an XKB peculiarity that will help with testing):
xkb_symbols "us-greek"
···
+
A minimal layout specification must include the following:
<xref linkend="opt-services.xserver.extraLayouts"/>.us-greek = {
description = "US layout with alt-gr greek";
+
symbolsFile = /yourpath/symbols/us-greek;
···
+
Applying this customization requires rebuilding several packages,
+
and a broken XKB file can lead to the X session crashing at login.
+
Therefore, you're strongly advised to <emphasis role="strong">test
+
your layout before applying it</emphasis>:
+
<prompt>$ </prompt>nix-shell -p xorg.xkbcomp
+
<prompt>$ </prompt>setxkbmap -I/yourpath us-greek -print | xkbcomp -I/yourpath - $DISPLAY
+
You can inspect the predefined XKB files for examples:
+
<prompt>$ </prompt>echo "$(nix-build --no-out-link '<nixpkgs>' -A xorg.xkeyboardconfig)/etc/X11/xkb/"
+
Once the configuration is applied, and you did a logout/login
+
cycle, the layout should be ready to use. You can try it by e.g.
+
running <literal>setxkbmap us-greek</literal> and then type
+
<literal><alt>+a</literal> (it may not get applied in your
+
terminal straight away). To change the default, the usual
<link linkend="opt-services.xserver.layout">