The X server will automatically detect and use the appropriate video driver from a set of X.org drivers (such as <literal>vesa</literal> and <literal>intel</literal>). You can also specify a driver manually, e.g.
You also need to enable at least one desktop or window manager. Otherwise, you can only log into a plain undecorated <command>xterm</command> window. Thus you should pick one or more of the following lines:
NixOS’s default <emphasis>display manager</emphasis> (the program that provides a graphical login prompt and manages the X server) is LightDM. You can select an alternative one by picking one of the following lines:
This is especially helpful if you have disk encryption enabled. Since you already have to provide a password to decrypt your disk, entering a second password to login can be redundant.
To enable auto-login, you need to define your default window manager and desktop environment. If you wanted no desktop environment and i3 as your your window manager, you'd define:
NVIDIA provides a proprietary driver for its graphics cards that has better 3D performance than the X.org drivers. It is not enabled by default because it’s not free software. You can enable it as follows:
AMD provides a proprietary driver for its graphics cards that has better 3D performance than the X.org drivers. It is not enabled by default because it’s not free software. You can enable it as follows:
GTK themes can be installed either to user profile or system-wide (via <literal>environment.systemPackages</literal>). To make Qt 5 applications look similar to GTK2 ones, you can install <literal>qt5.qtbase.gtk</literal> package into your system environment. It should work for all Qt 5 library versions.
It is possible to install custom <linkxlink:href="https://en.wikipedia.org/wiki/X_keyboard_extension"> XKB </link> keyboard layouts using the option <option><linklinkend="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 right-alt key.
The layout should now be installed and ready to use: try it by running <literal>setxkbmap us-greek</literal> and type <literal><alt>+a</literal>. To change the default the usual <option><linklinkend="opt-services.xserver.layout"> services.xserver.layout </link></option> option can still be used.
A layout can have several other components besides <literal>xkb_symbols</literal>, for example we will define new keycodes for some multimedia key and bind these to some symbol.
Use the <emphasis>xev</emphasis> utility from <literal>pkgs.xorg.xev</literal> to find the codes of the keys of interest, then create a <literal>media-key</literal> file to hold the keycodes definitions
The function <literal>pkgs.writeText <filename><content></literal> can be useful if you prefer to keep the layout definitions inside the NixOS configuration.
Unfortunately, the Xorg server does not (currently) support setting a keymap directly but relies instead on XKB rules to select the matching components (keycodes, types, ...) of a layout. This means that components other than symbols won't be loaded by default. As a workaround, you can set the keymap using <literal>setxkbmap</literal> at the start of the session with:
If you are manually starting the X server, you should set the argument <literal>-xkbdir /etc/X11/xkb</literal>, otherwise X won't find your layout files. For example with <command>xinit</command> run
To learn how to write layouts take a look at the XKB <linkxlink:href="https://www.x.org/releases/current/doc/xorg-docs/input/XKB-Enhancing.html#Defining_New_Layouts"> documentation </link>. More example layouts can also be found <linkxlink:href="https://wiki.archlinux.org/index.php/X_KeyBoard_extension#Basic_examples"> here </link>.