1<chapter xmlns="http://docbook.org/ns/docbook"
2 xmlns:xlink="http://www.w3.org/1999/xlink"
3 xmlns:xi="http://www.w3.org/2001/XInclude"
4 version="5.0"
5 xml:id="sec-x11">
6
7<title>X Window System</title>
8
9<para>The X Window System (X11) provides the basis of NixOS’ graphical
10user interface. It can be enabled as follows:
11<programlisting>
12services.xserver.enable = true;
13</programlisting>
14The X server will automatically detect and use the appropriate video
15driver from a set of X.org drivers (such as <literal>vesa</literal>
16and <literal>intel</literal>). You can also specify a driver
17manually, e.g.
18<programlisting>
19services.xserver.videoDrivers = [ "r128" ];
20</programlisting>
21to enable X.org’s <literal>xf86-video-r128</literal> driver.</para>
22
23<para>You also need to enable at least one desktop or window manager.
24Otherwise, you can only log into a plain undecorated
25<command>xterm</command> window. Thus you should pick one or more of
26the following lines:
27<programlisting>
28services.xserver.desktopManager.plasma5.enable = true;
29services.xserver.desktopManager.xfce.enable = true;
30services.xserver.desktopManager.gnome3.enable = true;
31services.xserver.windowManager.xmonad.enable = true;
32services.xserver.windowManager.twm.enable = true;
33services.xserver.windowManager.icewm.enable = true;
34services.xserver.windowManager.i3.enable = true;
35</programlisting>
36</para>
37
38<para>NixOS’s default <emphasis>display manager</emphasis> (the
39program that provides a graphical login prompt and manages the X
40server) is SLiM. You can select an alternative one by picking one
41of the following lines:
42<programlisting>
43services.xserver.displayManager.sddm.enable = true;
44services.xserver.displayManager.lightdm.enable = true;
45</programlisting>
46</para>
47
48<para>You can set the keyboard layout (and optionally the layout variant):
49<programlisting>
50services.xserver.layout = "de";
51services.xserver.xkbVariant = "neo";
52</programlisting>
53</para>
54
55<para>The X server is started automatically at boot time. If you
56don’t want this to happen, you can set:
57<programlisting>
58services.xserver.autorun = false;
59</programlisting>
60The X server can then be started manually:
61<screen>
62# systemctl start display-manager.service
63</screen>
64</para>
65
66
67<simplesect><title>NVIDIA Graphics Cards</title>
68
69<para>NVIDIA provides a proprietary driver for its graphics cards that
70has better 3D performance than the X.org drivers. It is not enabled
71by default because it’s not free software. You can enable it as follows:
72<programlisting>
73services.xserver.videoDrivers = [ "nvidia" ];
74</programlisting>
75Or if you have an older card, you may have to use one of the legacy drivers:
76<programlisting>
77services.xserver.videoDrivers = [ "nvidiaLegacy340" ];
78services.xserver.videoDrivers = [ "nvidiaLegacy304" ];
79services.xserver.videoDrivers = [ "nvidiaLegacy173" ];
80</programlisting>
81You may need to reboot after enabling this driver to prevent a clash
82with other kernel modules.</para>
83
84<para>On 64-bit systems, if you want full acceleration for 32-bit
85programs such as Wine, you should also set the following:
86<programlisting>
87hardware.opengl.driSupport32Bit = true;
88</programlisting>
89</para>
90
91</simplesect>
92
93<simplesect><title>AMD Graphics Cards</title>
94
95<para>AMD provides a proprietary driver for its graphics cards that
96has better 3D performance than the X.org drivers. It is not enabled
97by default because it’s not free software. You can enable it as follows:
98<programlisting>
99services.xserver.videoDrivers = [ "ati_unfree" ];
100</programlisting>
101You will need to reboot after enabling this driver to prevent a clash
102with other kernel modules.</para>
103
104<para>On 64-bit systems, if you want full acceleration for 32-bit
105programs such as Wine, you should also set the following:
106<programlisting>
107hardware.opengl.driSupport32Bit = true;
108</programlisting>
109</para>
110
111</simplesect>
112
113<simplesect><title>Touchpads</title>
114
115<para>Support for Synaptics touchpads (found in many laptops such as
116the Dell Latitude series) can be enabled as follows:
117<programlisting>
118services.xserver.synaptics.enable = true;
119</programlisting>
120The driver has many options (see <xref linkend="ch-options"/>). For
121instance, the following enables two-finger scrolling:
122<programlisting>
123services.xserver.synaptics.twoFingerScroll = true;
124</programlisting>
125</para>
126
127</simplesect>
128
129<simplesect><title>GTK/Qt themes</title>
130
131<para>GTK themes can be installed either to user profile or system-wide (via
132<literal>system.environmentPackages</literal>). To make Qt 5 applications look similar
133to GTK2 ones, you can install <literal>qt5.qtbase.gtk</literal> package into your
134system environment. It should work for all Qt 5 library versions.
135</para>
136
137</simplesect>
138
139</chapter>