X Window System
The X Window System (X11) provides the basis of NixOS’ graphical
user interface. It can be enabled as follows:
services.xserver.enable = true;
The X server will automatically detect and use the appropriate video
driver from a set of X.org drivers (such as vesa
and intel). You can also specify a driver
manually, e.g.
services.xserver.videoDrivers = [ "r128" ];
to enable X.org’s xf86-video-r128 driver.
You also need to enable at least one desktop or window manager.
Otherwise, you can only log into a plain undecorated
xterm window. Thus you should pick one or more of
the following lines:
services.xserver.desktopManager.kde4.enable = true;
services.xserver.desktopManager.xfce.enable = true;
services.xserver.windowManager.xmonad.enable = true;
services.xserver.windowManager.twm.enable = true;
services.xserver.windowManager.icewm.enable = true;
NixOS’s default display manager (the
program that provides a graphical login prompt and manages the X
server) is SLiM. You can select KDE’s kdm instead:
services.xserver.displayManager.kdm.enable = true;
The X server is started automatically at boot time. If you
don’t want this to happen, you can set:
services.xserver.autorun = false;
The X server can then be started manually:
# systemctl start display-manager.service
NVIDIA Graphics Cards
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:
services.xserver.videoDrivers = [ "nvidia" ];
Or if you have an older card, you may have to use one of the legacy drivers:
services.xserver.videoDrivers = [ "nvidiaLegacy340" ];
services.xserver.videoDrivers = [ "nvidiaLegacy304" ];
services.xserver.videoDrivers = [ "nvidiaLegacy173" ];
You may need to reboot after enabling this driver to prevent a clash
with other kernel modules.
On 64-bit systems, if you want full acceleration for 32-bit
programs such as Wine, you should also set the following:
hardware.opengl.driSupport32Bit = true;
AMD Graphics Cards
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:
services.xserver.videoDrivers = [ "ati_unfree" ];
You will need to reboot after enabling this driver to prevent a clash
with other kernel modules.
On 64-bit systems, if you want full acceleration for 32-bit
programs such as Wine, you should also set the following:
hardware.opengl.driSupport32Bit = true;
Touchpads
Support for Synaptics touchpads (found in many laptops such as
the Dell Latitude series) can be enabled as follows:
services.xserver.synaptics.enable = true;
The driver has many options (see ). For
instance, the following enables two-finger scrolling:
services.xserver.synaptics.twoFingerScroll = true;
GTK/Qt themes
GTK themes can be installed either to user profile or system-wide (via
system.environmentPackages). To make Qt 5 applications look similar
to GTK2 ones, you can install qt5.qtbase.gtk package into your
system environment. It should work for all Qt 5 library versions.