Commit | Line | Data |
---|---|---|
db4fdc04 | 1 | ;;; GNU Guix --- Functional package management for GNU |
92753a8b | 2 | ;;; Copyright © 2017 Andy Wingo <wingo@igalia.com> |
dd0804c6 | 3 | ;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2019, 2020 Ludovic Courtès <ludo@gnu.org> |
4bd43bbe | 4 | ;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com> |
e57c2adb | 5 | ;;; Copyright © 2018, 2019 Timothy Sample <samplet@ngyro.com> |
24f11b06 | 6 | ;;; Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> |
bab7a495 | 7 | ;;; Copyright © 2019 Tim Gesthuizen <tim.gesthuizen@yahoo.de> |
779d96c9 | 8 | ;;; Copyright © 2020 shtwzrd <shtwzrd@protonmail.com> |
50be0da7 | 9 | ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net> |
d8258177 | 10 | ;;; Copyright © 2020 Alex Griffin <a@ajgrf.com> |
db4fdc04 LC |
11 | ;;; |
12 | ;;; This file is part of GNU Guix. | |
13 | ;;; | |
14 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
15 | ;;; under the terms of the GNU General Public License as published by | |
16 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
17 | ;;; your option) any later version. | |
18 | ;;; | |
19 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
20 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
21 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
22 | ;;; GNU General Public License for more details. | |
23 | ;;; | |
24 | ;;; You should have received a copy of the GNU General Public License | |
25 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
26 | ||
27 | (define-module (gnu services xorg) | |
84dfb458 | 28 | #:use-module (gnu artwork) |
db4fdc04 | 29 | #:use-module (gnu services) |
0190c1c0 | 30 | #:use-module (gnu services shepherd) |
6e828634 | 31 | #:use-module (gnu system pam) |
598757e0 | 32 | #:use-module (gnu system keyboard) |
607fcc75 | 33 | #:use-module (gnu services base) |
6e99c01b | 34 | #:use-module (gnu services dbus) |
dfc8ccbf | 35 | #:use-module (gnu packages base) |
bdb36958 | 36 | #:use-module (gnu packages guile) |
db4fdc04 | 37 | #:use-module (gnu packages xorg) |
7e614198 | 38 | #:use-module (gnu packages fonts) |
db4fdc04 | 39 | #:use-module (gnu packages gl) |
1f564c15 | 40 | #:use-module (gnu packages glib) |
5fd66a37 | 41 | #:use-module (gnu packages display-managers) |
607fcc75 | 42 | #:use-module (gnu packages freedesktop) |
9e4eddb4 | 43 | #:use-module (gnu packages gnustep) |
6e99c01b | 44 | #:use-module (gnu packages gnome) |
db4fdc04 LC |
45 | #:use-module (gnu packages admin) |
46 | #:use-module (gnu packages bash) | |
6e99c01b | 47 | #:use-module (gnu system shadow) |
b5f4e686 | 48 | #:use-module (guix gexp) |
e87f0591 | 49 | #:use-module (guix store) |
6726282b | 50 | #:use-module (guix packages) |
db4fdc04 | 51 | #:use-module (guix derivations) |
ffc3a02b | 52 | #:use-module (guix records) |
65a67bf7 | 53 | #:use-module (guix deprecation) |
d2e59637 | 54 | #:use-module (srfi srfi-1) |
6726282b | 55 | #:use-module (srfi srfi-9) |
d2e59637 LC |
56 | #:use-module (srfi srfi-26) |
57 | #:use-module (ice-9 match) | |
b2e56451 LC |
58 | #:export (xorg-configuration |
59 | xorg-configuration? | |
60 | xorg-configuration-modules | |
61 | xorg-configuration-fonts | |
62 | xorg-configuration-drivers | |
63 | xorg-configuration-resolutions | |
64 | xorg-configuration-extra-config | |
65 | xorg-configuration-server | |
66 | xorg-configuration-server-arguments | |
67 | ||
79fd74fa | 68 | %default-xorg-modules |
d344f5a5 | 69 | %default-xorg-fonts |
92753a8b | 70 | xorg-wrapper |
d1cdd7ba | 71 | xorg-start-command |
f2901d82 DC |
72 | xinitrc |
73 | ||
0ecc3bf3 LC |
74 | %default-slim-theme |
75 | %default-slim-theme-name | |
b37f86d7 | 76 | |
4b7513e0 | 77 | slim-configuration |
b37f86d7 LC |
78 | slim-configuration? |
79 | slim-configuration-slim | |
80 | slim-configuration-allow-empty-passwords? | |
81 | slim-configuration-auto-login? | |
82 | slim-configuration-default-user | |
83 | slim-configuration-theme | |
84 | slim-configuration-theme-name | |
85 | slim-configuration-xauth | |
86 | slim-configuration-shepherd | |
87 | slim-configuration-auto-login-session | |
bab7a495 | 88 | slim-configuration-xorg |
61569171 DNB |
89 | slim-configuration-display |
90 | slim-configuration-vt | |
bab7a495 | 91 | slim-configuration-sessreg |
b37f86d7 | 92 | |
4b7513e0 | 93 | slim-service-type |
6726282b LC |
94 | slim-service |
95 | ||
24e96431 TČ |
96 | screen-locker |
97 | screen-locker? | |
6726282b | 98 | screen-locker-service-type |
6e99c01b AW |
99 | screen-locker-service |
100 | ||
607fcc75 LC |
101 | localed-configuration |
102 | localed-configuration? | |
103 | localed-service-type | |
104 | ||
6e99c01b AW |
105 | gdm-configuration |
106 | gdm-service-type | |
305a732a | 107 | gdm-service |
50be0da7 JK |
108 | |
109 | handle-xorg-configuration | |
305a732a | 110 | set-xorg-configuration)) |
db4fdc04 LC |
111 | |
112 | ;;; Commentary: | |
113 | ;;; | |
114 | ;;; Services that relate to the X Window System. | |
115 | ;;; | |
116 | ;;; Code: | |
117 | ||
d344f5a5 | 118 | (define %default-xorg-modules |
fd96f94f PN |
119 | ;; Default list of modules loaded by the server. When multiple drivers |
120 | ;; match, the first one in the list is loaded. | |
d344f5a5 LC |
121 | (list xf86-video-vesa |
122 | xf86-video-fbdev | |
fd96f94f | 123 | xf86-video-amdgpu |
d344f5a5 LC |
124 | xf86-video-ati |
125 | xf86-video-cirrus | |
126 | xf86-video-intel | |
127 | xf86-video-mach64 | |
128 | xf86-video-nouveau | |
129 | xf86-video-nv | |
130 | xf86-video-sis | |
131 | ||
132 | ;; Libinput is the new thing and is recommended over evdev/synaptics: | |
133 | ;; <http://who-t.blogspot.fr/2015/01/xf86-input-libinput-compatibility-with.html>. | |
134 | xf86-input-libinput | |
135 | ||
136 | xf86-input-evdev | |
137 | xf86-input-keyboard | |
138 | xf86-input-mouse | |
139 | xf86-input-synaptics)) | |
140 | ||
141 | (define %default-xorg-fonts | |
142 | ;; Default list of fonts available to the X server. | |
143 | (list (file-append font-alias "/share/fonts/X11/75dpi") | |
144 | (file-append font-alias "/share/fonts/X11/100dpi") | |
145 | (file-append font-alias "/share/fonts/X11/misc") | |
146 | (file-append font-alias "/share/fonts/X11/cyrillic") | |
4afc903a LC |
147 | (file-append font-misc-misc ;default fonts for xterm |
148 | "/share/fonts/X11/misc") | |
d344f5a5 LC |
149 | (file-append font-adobe75dpi "/share/fonts/X11/75dpi"))) |
150 | ||
b2e56451 LC |
151 | (define %default-xorg-server-arguments |
152 | ;; Default command-line arguments for X. | |
153 | '("-nolisten" "tcp")) | |
154 | ||
155 | ;; Configuration of an Xorg server. | |
156 | (define-record-type* <xorg-configuration> | |
157 | xorg-configuration make-xorg-configuration | |
158 | xorg-configuration? | |
159 | (modules xorg-configuration-modules ;list of packages | |
779d96c9 | 160 | ; filter out modules not supported on current system |
161 | (default (filter | |
162 | (lambda (p) | |
163 | (member (%current-system) | |
164 | (package-supported-systems p))) | |
165 | %default-xorg-modules))) | |
b2e56451 LC |
166 | (fonts xorg-configuration-fonts ;list of packges |
167 | (default %default-xorg-fonts)) | |
168 | (drivers xorg-configuration-drivers ;list of strings | |
169 | (default '())) | |
170 | (resolutions xorg-configuration-resolutions ;list of tuples | |
171 | (default '())) | |
598757e0 LC |
172 | (keyboard-layout xorg-configuration-keyboard-layout ;#f | <keyboard-layout> |
173 | (default #f)) | |
b2e56451 LC |
174 | (extra-config xorg-configuration-extra-config ;list of strings |
175 | (default '())) | |
176 | (server xorg-configuration-server ;package | |
177 | (default xorg-server)) | |
178 | (server-arguments xorg-configuration-server-arguments ;list of strings | |
179 | (default %default-xorg-server-arguments))) | |
180 | ||
181 | (define (xorg-configuration->file config) | |
182 | "Compute an Xorg configuration file corresponding to CONFIG, an | |
183 | <xorg-configuration> record." | |
8b158e8b CR |
184 | (let ((xorg-server (xorg-configuration-server config))) |
185 | (define all-modules | |
186 | ;; 'xorg-server' provides 'fbdevhw.so' etc. | |
187 | (append (xorg-configuration-modules config) | |
188 | (list xorg-server))) | |
d344f5a5 | 189 | |
8b158e8b CR |
190 | (define build |
191 | #~(begin | |
192 | (use-modules (ice-9 match) | |
193 | (srfi srfi-1) | |
194 | (srfi srfi-26)) | |
d344f5a5 | 195 | |
8b158e8b CR |
196 | (call-with-output-file #$output |
197 | (lambda (port) | |
198 | (define drivers | |
199 | '#$(xorg-configuration-drivers config)) | |
d344f5a5 | 200 | |
8b158e8b CR |
201 | (define (device-section driver) |
202 | (string-append " | |
f703413e LC |
203 | Section \"Device\" |
204 | Identifier \"device-" driver "\" | |
205 | Driver \"" driver "\" | |
206 | EndSection")) | |
db4fdc04 | 207 | |
8b158e8b CR |
208 | (define (screen-section driver resolutions) |
209 | (string-append " | |
d2e59637 LC |
210 | Section \"Screen\" |
211 | Identifier \"screen-" driver "\" | |
212 | Device \"device-" driver "\" | |
213 | SubSection \"Display\" | |
214 | Modes " | |
215 | (string-join (map (match-lambda | |
d1cdd7ba LC |
216 | ((x y) |
217 | (string-append "\"" (number->string x) | |
218 | "x" (number->string y) "\""))) | |
d2e59637 LC |
219 | resolutions)) " |
220 | EndSubSection | |
221 | EndSection")) | |
222 | ||
8b158e8b CR |
223 | (define (input-class-section layout variant model options) |
224 | (string-append " | |
598757e0 LC |
225 | Section \"InputClass\" |
226 | Identifier \"evdev keyboard catchall\" | |
227 | MatchIsKeyboard \"on\" | |
228 | Option \"XkbLayout\" " (object->string layout) | |
229 | (if variant | |
230 | (string-append " Option \"XkbVariant\" \"" | |
231 | variant "\"") | |
232 | "") | |
233 | (if model | |
234 | (string-append " Option \"XkbModel\" \"" | |
235 | model "\"") | |
236 | "") | |
237 | (match options | |
238 | (() | |
239 | "") | |
240 | (_ | |
241 | (string-append " Option \"XkbOptions\" \"" | |
242 | (string-join options ",") "\""))) " | |
243 | ||
244 | MatchDevicePath \"/dev/input/event*\" | |
245 | Driver \"evdev\" | |
246 | EndSection\n")) | |
247 | ||
8b158e8b CR |
248 | (define (expand modules) |
249 | ;; Append to MODULES the relevant /lib/xorg/modules | |
250 | ;; sub-directories. | |
251 | (append-map (lambda (module) | |
252 | (filter-map (lambda (directory) | |
253 | (let ((full (string-append module | |
254 | directory))) | |
255 | (and (file-exists? full) | |
256 | full))) | |
257 | '("/lib/xorg/modules/drivers" | |
258 | "/lib/xorg/modules/input" | |
259 | "/lib/xorg/modules/multimedia" | |
260 | "/lib/xorg/modules/extensions"))) | |
261 | modules)) | |
db4fdc04 | 262 | |
8b158e8b CR |
263 | (display "Section \"Files\"\n" port) |
264 | (for-each (lambda (font) | |
265 | (format port " FontPath \"~a\"~%" font)) | |
266 | '#$(xorg-configuration-fonts config)) | |
267 | (for-each (lambda (module) | |
268 | (format port | |
269 | " ModulePath \"~a\"~%" | |
270 | module)) | |
271 | (append (expand '#$all-modules) | |
d344f5a5 | 272 | |
8b158e8b CR |
273 | ;; For fbdevhw.so and so on. |
274 | (list #$(file-append xorg-server | |
275 | "/lib/xorg/modules")))) | |
276 | (display "EndSection\n" port) | |
277 | (display " | |
db4fdc04 | 278 | Section \"ServerFlags\" |
e30442b5 | 279 | Option \"AllowMouseOpenFail\" \"on\" |
d344f5a5 | 280 | EndSection\n" port) |
12422c9d | 281 | |
8b158e8b CR |
282 | (display (string-join (map device-section drivers) "\n") |
283 | port) | |
284 | (newline port) | |
285 | (display (string-join | |
286 | (map (cut screen-section <> | |
287 | '#$(xorg-configuration-resolutions config)) | |
288 | drivers) | |
289 | "\n") | |
290 | port) | |
291 | (newline port) | |
d344f5a5 | 292 | |
8b158e8b CR |
293 | (let ((layout #$(and=> (xorg-configuration-keyboard-layout config) |
294 | keyboard-layout-name)) | |
295 | (variant #$(and=> (xorg-configuration-keyboard-layout config) | |
296 | keyboard-layout-variant)) | |
297 | (model #$(and=> (xorg-configuration-keyboard-layout config) | |
298 | keyboard-layout-model)) | |
299 | (options '#$(and=> (xorg-configuration-keyboard-layout config) | |
300 | keyboard-layout-options))) | |
301 | (when layout | |
302 | (display (input-class-section layout variant model options) | |
303 | port) | |
304 | (newline port))) | |
598757e0 | 305 | |
8b158e8b CR |
306 | (for-each (lambda (config) |
307 | (display config port)) | |
308 | '#$(xorg-configuration-extra-config config)))))) | |
d344f5a5 | 309 | |
8b158e8b | 310 | (computed-file "xserver.conf" build))) |
db4fdc04 | 311 | |
79fd74fa AW |
312 | (define (xorg-configuration-directory modules) |
313 | "Return a directory that contains the @code{.conf} files for X.org that | |
314 | includes the @code{share/X11/xorg.conf.d} directories of each package listed | |
315 | in @var{modules}." | |
4ee96a79 LC |
316 | (with-imported-modules '((guix build utils)) |
317 | (computed-file "xorg.conf.d" | |
318 | #~(begin | |
319 | (use-modules (guix build utils) | |
320 | (srfi srfi-1)) | |
321 | ||
322 | (define files | |
323 | (append-map (lambda (module) | |
324 | (find-files (string-append | |
325 | module | |
326 | "/share/X11/xorg.conf.d") | |
327 | "\\.conf$")) | |
328 | (list #$@modules))) | |
329 | ||
330 | (mkdir #$output) | |
331 | (for-each (lambda (file) | |
332 | (symlink file | |
333 | (string-append #$output "/" | |
334 | (basename file)))) | |
335 | files) | |
336 | #t)))) | |
79fd74fa | 337 | |
b2e56451 LC |
338 | (define* (xorg-wrapper #:optional (config (xorg-configuration))) |
339 | "Return a derivation that builds a script to start the X server with the | |
340 | given @var{config}. The resulting script should be used in place of | |
341 | @code{/usr/bin/X}." | |
be1c2c54 LC |
342 | (define exp |
343 | ;; Write a small wrapper around the X server. | |
344 | #~(begin | |
345 | (setenv "XORG_DRI_DRIVER_PATH" (string-append #$mesa "/lib/dri")) | |
346 | (setenv "XKB_BINDIR" (string-append #$xkbcomp "/bin")) | |
347 | ||
b2e56451 | 348 | (let ((X (string-append #$(xorg-configuration-server config) "/bin/X"))) |
92753a8b AW |
349 | (apply execl X X |
350 | "-xkbdir" (string-append #$xkeyboard-config "/share/X11/xkb") | |
b2e56451 LC |
351 | "-config" #$(xorg-configuration->file config) |
352 | "-configdir" #$(xorg-configuration-directory | |
353 | (xorg-configuration-modules config)) | |
92753a8b AW |
354 | (cdr (command-line)))))) |
355 | ||
356 | (program-file "X-wrapper" exp)) | |
be1c2c54 | 357 | |
b2e56451 LC |
358 | (define* (xorg-start-command #:optional (config (xorg-configuration))) |
359 | "Return a @code{startx} script in which the modules, fonts, etc. specified | |
360 | in @var{config}, are available. The result should be used in place of | |
361 | @code{startx}." | |
92753a8b | 362 | (define X |
b2e56451 LC |
363 | (xorg-wrapper config)) |
364 | ||
92753a8b AW |
365 | (define exp |
366 | ;; Write a small wrapper around the X server. | |
367 | #~(apply execl #$X #$X ;; Second #$X is for argv[0]. | |
b2e56451 LC |
368 | "-logverbose" "-verbose" "-terminate" |
369 | #$@(xorg-configuration-server-arguments config) | |
24f11b06 | 370 | (cdr (command-line)))) |
be1c2c54 | 371 | |
92753a8b | 372 | (program-file "startx" exp)) |
db4fdc04 | 373 | |
956607e3 | 374 | (define* (xinitrc #:key fallback-session) |
24d56899 SB |
375 | "Return a system-wide xinitrc script that starts the specified X session, |
376 | which should be passed to this script as the first argument. If not, the | |
65c0f436 LC |
377 | @var{fallback-session} will be used or, if @var{fallback-session} is false, a |
378 | desktop session from the system or user profile will be used." | |
8779d342 LC |
379 | (define builder |
380 | #~(begin | |
65c0f436 LC |
381 | (use-modules (ice-9 match) |
382 | (ice-9 regex) | |
383 | (ice-9 ftw) | |
4e1efba4 | 384 | (ice-9 rdelim) |
65c0f436 LC |
385 | (srfi srfi-1) |
386 | (srfi srfi-26)) | |
8779d342 | 387 | |
16c33bfb LC |
388 | (define (close-all-fdes) |
389 | ;; Close all the open file descriptors except 0 to 2. | |
390 | (let loop ((fd 3)) | |
391 | (when (< fd 4096) ;FIXME: use sysconf + _SC_OPEN_MAX | |
392 | (false-if-exception (close-fdes fd)) | |
393 | (loop (+ 1 fd))))) | |
394 | ||
b2bd7c25 LC |
395 | (define (exec-from-login-shell command . args) |
396 | ;; Run COMMAND from a login shell so that it gets to see the same | |
397 | ;; environment variables that one gets when logging in on a tty, for | |
398 | ;; instance. | |
399 | (let* ((pw (getpw (getuid))) | |
e0b85670 SB |
400 | (shell (passwd:shell pw))) |
401 | ;; Close any open file descriptors. This is all the more | |
402 | ;; important that SLiM itself exec's us directly without closing | |
403 | ;; its own file descriptors! | |
404 | (close-all-fdes) | |
405 | ||
406 | ;; The '--login' option is supported at least by Bash and zsh. | |
407 | (execl shell shell "--login" "-c" | |
408 | (string-join (cons command args))))) | |
409 | ||
65c0f436 LC |
410 | (define system-profile |
411 | "/run/current-system/profile") | |
412 | ||
413 | (define user-profile | |
414 | (and=> (getpw (getuid)) | |
415 | (lambda (pw) | |
416 | (string-append (passwd:dir pw) "/.guix-profile")))) | |
417 | ||
418 | (define (xsession-command desktop-file) | |
419 | ;; Read from DESKTOP-FILE its X session command and return it as a | |
420 | ;; list. | |
421 | (define exec-regexp | |
422 | (make-regexp "^[[:blank:]]*Exec=(.*)$")) | |
423 | ||
424 | (call-with-input-file desktop-file | |
425 | (lambda (port) | |
426 | (let loop () | |
427 | (match (read-line port) | |
428 | ((? eof-object?) #f) | |
429 | ((= (cut regexp-exec exec-regexp <>) result) | |
430 | (if result | |
431 | (string-tokenize (match:substring result 1)) | |
432 | (loop)))))))) | |
433 | ||
434 | (define (find-session profile) | |
435 | ;; Return an X session command from PROFILE or #f if none was found. | |
436 | (let ((directory (string-append profile "/share/xsessions"))) | |
437 | (match (scandir directory | |
438 | (cut string-suffix? ".desktop" <>)) | |
439 | ((or () #f) | |
440 | #f) | |
441 | ((sessions ...) | |
442 | (any xsession-command | |
443 | (map (cut string-append directory "/" <>) | |
444 | sessions)))))) | |
445 | ||
e0b85670 SB |
446 | (let* ((home (getenv "HOME")) |
447 | (xsession-file (string-append home "/.xsession")) | |
448 | (session (match (command-line) | |
65c0f436 LC |
449 | ((_) |
450 | #$(if fallback-session | |
451 | #~(list #$fallback-session) | |
452 | #f)) | |
453 | ((_ x ..1) | |
454 | x)))) | |
e0b85670 SB |
455 | (if (file-exists? xsession-file) |
456 | ;; Run ~/.xsession when it exists. | |
617e87bf LC |
457 | (apply exec-from-login-shell xsession-file |
458 | (or session '())) | |
65c0f436 LC |
459 | ;; Otherwise, start the specified session or a fallback. |
460 | (apply exec-from-login-shell | |
461 | (or session | |
462 | (find-session user-profile) | |
463 | (find-session system-profile))))))) | |
c510cbb4 | 464 | |
be1c2c54 | 465 | (program-file "xinitrc" builder)) |
9e4eddb4 | 466 | |
50be0da7 JK |
467 | (define-syntax handle-xorg-configuration |
468 | (syntax-rules () | |
469 | "Generate the `compose' and `extend' entries of a login manager | |
470 | `service-type' to handle specifying the `xorg-configuration' through | |
471 | a `service-extension', as used by `set-xorg-configuration'." | |
472 | ((_ configuration-record service-type-definition) | |
473 | (service-type | |
474 | (inherit service-type-definition) | |
475 | (compose (lambda (extensions) | |
476 | (match extensions | |
477 | (() #f) | |
478 | ((config . _) config)))) | |
479 | (extend (lambda (config xorg-configuration) | |
480 | (if xorg-configuration | |
481 | (configuration-record | |
482 | (inherit config) | |
483 | (xorg-configuration xorg-configuration)) | |
484 | config))))))) | |
485 | ||
0ecc3bf3 LC |
486 | \f |
487 | ;;; | |
488 | ;;; SLiM log-in manager. | |
489 | ;;; | |
490 | ||
0ecc3bf3 LC |
491 | (define %default-slim-theme |
492 | ;; Theme based on work by Felipe López. | |
9e41130b | 493 | (file-append %artwork-repository "/slim")) |
0ecc3bf3 LC |
494 | |
495 | (define %default-slim-theme-name | |
496 | ;; This must be the name of the sub-directory in %DEFAULT-SLIM-THEME that | |
497 | ;; contains the actual theme files. | |
2f9f792a | 498 | "1.x") |
0ecc3bf3 | 499 | |
0adfe95a LC |
500 | (define-record-type* <slim-configuration> |
501 | slim-configuration make-slim-configuration | |
502 | slim-configuration? | |
503 | (slim slim-configuration-slim | |
504 | (default slim)) | |
b37f86d7 LC |
505 | (allow-empty-passwords? slim-configuration-allow-empty-passwords? |
506 | (default #t)) | |
507 | (auto-login? slim-configuration-auto-login? | |
508 | (default #f)) | |
509 | (default-user slim-configuration-default-user | |
510 | (default "")) | |
511 | (theme slim-configuration-theme | |
512 | (default %default-slim-theme)) | |
513 | (theme-name slim-configuration-theme-name | |
514 | (default %default-slim-theme-name)) | |
0adfe95a LC |
515 | (xauth slim-configuration-xauth |
516 | (default xauth)) | |
26b94866 AK |
517 | (shepherd slim-configuration-shepherd |
518 | (default shepherd)) | |
b37f86d7 | 519 | (auto-login-session slim-configuration-auto-login-session |
65c0f436 | 520 | (default #f)) |
554b8607 LC |
521 | (xorg-configuration slim-configuration-xorg |
522 | (default (xorg-configuration))) | |
61569171 DNB |
523 | (display slim-configuration-display |
524 | (default ":0")) | |
525 | (vt slim-configuration-vt | |
526 | (default "vt7")) | |
736e45a2 DM |
527 | (sessreg slim-configuration-sessreg |
528 | (default sessreg))) | |
0adfe95a LC |
529 | |
530 | (define (slim-pam-service config) | |
531 | "Return a PAM service for @command{slim}." | |
532 | (list (unix-pam-service | |
533 | "slim" | |
e6b1a224 | 534 | #:login-uid? #t |
0adfe95a LC |
535 | #:allow-empty-passwords? |
536 | (slim-configuration-allow-empty-passwords? config)))) | |
537 | ||
d4053c71 | 538 | (define (slim-shepherd-service config) |
61569171 DNB |
539 | (let* ((xinitrc (xinitrc #:fallback-session |
540 | (slim-configuration-auto-login-session config))) | |
541 | (xauth (slim-configuration-xauth config)) | |
542 | (startx (xorg-start-command (slim-configuration-xorg config))) | |
543 | (display (slim-configuration-display config)) | |
544 | (vt (slim-configuration-vt config)) | |
545 | (shepherd (slim-configuration-shepherd config)) | |
546 | (theme-name (slim-configuration-theme-name config)) | |
547 | (sessreg (slim-configuration-sessreg config)) | |
548 | (lockfile (string-append "/var/run/slim-" vt ".lock"))) | |
549 | (define slim.cfg | |
0adfe95a LC |
550 | (mixed-text-file "slim.cfg" " |
551 | default_path /run/current-system/profile/bin | |
552 | default_xserver " startx " | |
61569171 DNB |
553 | display_name " display " |
554 | xserver_arguments " vt " | |
0adfe95a | 555 | xauth_path " xauth "/bin/xauth |
61569171 DNB |
556 | authfile /var/run/slim-" vt ".auth |
557 | lockfile " lockfile " | |
558 | logfile /var/log/slim-" vt ".log | |
0adfe95a LC |
559 | |
560 | # The login command. '%session' is replaced by the chosen session name, one | |
561 | # of the names specified in the 'sessions' setting: 'wmaker', 'xfce', etc. | |
562 | login_cmd exec " xinitrc " %session | |
563 | sessiondir /run/current-system/profile/share/xsessions | |
564 | session_msg session (F1 to change): | |
736e45a2 DM |
565 | sessionstart_cmd " sessreg "/bin/sessreg -a -l $DISPLAY %user |
566 | sessionstop_cmd " sessreg "/bin/sessreg -d -l $DISPLAY %user | |
0adfe95a | 567 | |
26b94866 AK |
568 | halt_cmd " shepherd "/sbin/halt |
569 | reboot_cmd " shepherd "/sbin/reboot\n" | |
0adfe95a LC |
570 | (if (slim-configuration-auto-login? config) |
571 | (string-append "auto_login yes\ndefault_user " | |
572 | (slim-configuration-default-user config) "\n") | |
573 | "") | |
574 | (if theme-name | |
575 | (string-append "current_theme " theme-name "\n") | |
61569171 DNB |
576 | ""))) |
577 | ||
578 | (define theme | |
579 | (slim-configuration-theme config)) | |
580 | ||
581 | (list (shepherd-service | |
582 | (documentation "Xorg display server") | |
6ad799d7 LC |
583 | (provision (append |
584 | ;; For compatibility, also provide 'xorg-server'. | |
585 | (if (string=? vt "vt7") | |
586 | '(xorg-server) | |
587 | '()) | |
588 | ||
589 | (list (symbol-append 'xorg-server- | |
590 | (string->symbol vt))))) | |
61569171 DNB |
591 | (requirement '(user-processes host-name udev)) |
592 | (start | |
593 | #~(lambda () | |
594 | ;; A stale lock file can prevent SLiM from starting, so remove it to | |
595 | ;; be on the safe side. | |
596 | (false-if-exception (delete-file lockfile)) | |
597 | ||
598 | (fork+exec-command | |
599 | (list (string-append #$(slim-configuration-slim config) | |
600 | "/bin/slim") | |
601 | "-nodaemon") | |
602 | #:environment-variables | |
603 | (list (string-append "SLIM_CFGFILE=" #$slim.cfg) | |
604 | #$@(if theme | |
605 | (list #~(string-append "SLIM_THEMESDIR=" #$theme)) | |
606 | #~()))))) | |
607 | (stop #~(make-kill-destructor)) | |
608 | (respawn? #t))))) | |
0adfe95a LC |
609 | |
610 | (define slim-service-type | |
50be0da7 JK |
611 | (handle-xorg-configuration slim-configuration |
612 | (service-type (name 'slim) | |
613 | (extensions | |
614 | (list (service-extension shepherd-root-service-type | |
615 | slim-shepherd-service) | |
616 | (service-extension pam-root-service-type | |
617 | slim-pam-service) | |
e9b82124 | 618 | |
50be0da7 JK |
619 | ;; Unconditionally add xterm to the system profile, to |
620 | ;; avoid bad surprises. | |
621 | (service-extension profile-service-type | |
622 | (const (list xterm))))) | |
623 | ||
dd0804c6 LC |
624 | (default-value (slim-configuration)) |
625 | (description | |
626 | "Run the SLiM graphical login manager for X11.")))) | |
0adfe95a | 627 | |
65a67bf7 LC |
628 | (define-deprecated (slim-service #:key (slim slim) |
629 | (allow-empty-passwords? #t) auto-login? | |
630 | (default-user "") | |
631 | (theme %default-slim-theme) | |
632 | (theme-name %default-slim-theme-name) | |
633 | (xauth xauth) (shepherd shepherd) | |
634 | (auto-login-session #f) | |
635 | (startx (xorg-start-command))) | |
636 | slim-service-type | |
db4fdc04 | 637 | "Return a service that spawns the SLiM graphical login manager, which in |
51da7ca0 LC |
638 | turn starts the X display server with @var{startx}, a command as returned by |
639 | @code{xorg-start-command}. | |
db4fdc04 | 640 | |
04e4e6ab LC |
641 | @cindex X session |
642 | ||
643 | SLiM automatically looks for session types described by the @file{.desktop} | |
644 | files in @file{/run/current-system/profile/share/xsessions} and allows users | |
645 | to choose a session from the log-in screen using @kbd{F1}. Packages such as | |
646 | @var{xfce}, @var{sawfish}, and @var{ratpoison} provide @file{.desktop} files; | |
647 | adding them to the system-wide set of packages automatically makes them | |
648 | available at the log-in screen. | |
649 | ||
650 | In addition, @file{~/.xsession} files are honored. When available, | |
651 | @file{~/.xsession} must be an executable that starts a window manager | |
652 | and/or other X clients. | |
653 | ||
51da7ca0 LC |
654 | When @var{allow-empty-passwords?} is true, allow logins with an empty |
655 | password. When @var{auto-login?} is true, log in automatically as | |
24d56899 | 656 | @var{default-user} with @var{auto-login-session}. |
0ecc3bf3 LC |
657 | |
658 | If @var{theme} is @code{#f}, the use the default log-in theme; otherwise | |
659 | @var{theme} must be a gexp denoting the name of a directory containing the | |
660 | theme to use. In that case, @var{theme-name} specifies the name of the | |
4bd43bbe | 661 | theme." |
0adfe95a LC |
662 | (service slim-service-type |
663 | (slim-configuration | |
664 | (slim slim) | |
665 | (allow-empty-passwords? allow-empty-passwords?) | |
666 | (auto-login? auto-login?) (default-user default-user) | |
667 | (theme theme) (theme-name theme-name) | |
94b9abd9 | 668 | (xauth xauth) (shepherd shepherd) |
554b8607 | 669 | (auto-login-session auto-login-session)))) |
db4fdc04 | 670 | |
6726282b LC |
671 | \f |
672 | ;;; | |
673 | ;;; Screen lockers & co. | |
674 | ;;; | |
675 | ||
676 | (define-record-type <screen-locker> | |
677 | (screen-locker name program empty?) | |
678 | screen-locker? | |
679 | (name screen-locker-name) ;string | |
680 | (program screen-locker-program) ;gexp | |
681 | (empty? screen-locker-allows-empty-passwords?)) ;Boolean | |
682 | ||
683 | (define screen-locker-pam-services | |
684 | (match-lambda | |
685 | (($ <screen-locker> name _ empty?) | |
686 | (list (unix-pam-service name | |
687 | #:allow-empty-passwords? empty?))))) | |
688 | ||
689 | (define screen-locker-setuid-programs | |
690 | (compose list screen-locker-program)) | |
691 | ||
692 | (define screen-locker-service-type | |
693 | (service-type (name 'screen-locker) | |
694 | (extensions | |
695 | (list (service-extension pam-root-service-type | |
696 | screen-locker-pam-services) | |
697 | (service-extension setuid-program-service-type | |
dd0804c6 LC |
698 | screen-locker-setuid-programs))) |
699 | (description | |
700 | "Allow the given program to be used as a screen locker for | |
701 | the graphical server by making it setuid-root, so it can authenticate users, | |
702 | and by creating a PAM service for it."))) | |
6726282b LC |
703 | |
704 | (define* (screen-locker-service package | |
705 | #:optional | |
706 | (program (package-name package)) | |
707 | #:key allow-empty-passwords?) | |
d64e1746 | 708 | "Add @var{package}, a package for a screen locker or screen saver whose |
6726282b LC |
709 | command is @var{program}, to the set of setuid programs and add a PAM entry |
710 | for it. For example: | |
711 | ||
712 | @lisp | |
9e41130b | 713 | (screen-locker-service xlockmore \"xlock\") |
6726282b LC |
714 | @end lisp |
715 | ||
716 | makes the good ol' XlockMore usable." | |
717 | (service screen-locker-service-type | |
718 | (screen-locker program | |
9e41130b | 719 | (file-append package "/bin/" program) |
6726282b LC |
720 | allow-empty-passwords?))) |
721 | ||
607fcc75 LC |
722 | \f |
723 | ;;; | |
724 | ;;; Locale service. | |
725 | ;;; | |
726 | ||
727 | (define-record-type* <localed-configuration> | |
728 | localed-configuration make-localed-configuration | |
729 | localed-configuration? | |
730 | (localed localed-configuration-localed | |
731 | (default localed)) | |
732 | (keyboard-layout localed-configuration-keyboard-layout | |
733 | (default #f))) | |
734 | ||
735 | (define (localed-dbus-service config) | |
736 | "Return the 'localed' D-Bus service for @var{config}, a | |
737 | @code{<localed-configuration>} record." | |
738 | (define keyboard-layout | |
739 | (localed-configuration-keyboard-layout config)) | |
740 | ||
741 | ;; The primary purpose of 'localed' is to tell GDM what the "current" Xorg | |
742 | ;; keyboard layout is. If 'localed' is missing, or if it's unable to | |
743 | ;; determine the current XKB layout, then GDM forcefully installs its | |
744 | ;; default XKB config (US English). Here we communicate the configured | |
745 | ;; layout through environment variables. | |
746 | ||
747 | (if keyboard-layout | |
748 | (let* ((layout (keyboard-layout-name keyboard-layout)) | |
749 | (variant (keyboard-layout-variant keyboard-layout)) | |
750 | (model (keyboard-layout-model keyboard-layout)) | |
751 | (options (keyboard-layout-options keyboard-layout))) | |
752 | (list (wrapped-dbus-service | |
753 | (localed-configuration-localed config) | |
754 | "libexec/localed/localed" | |
755 | `(("GUIX_XKB_LAYOUT" ,layout) | |
756 | ,@(if variant | |
757 | `(("GUIX_XKB_VARIANT" ,variant)) | |
758 | '()) | |
759 | ,@(if model | |
760 | `(("GUIX_XKB_MODEL" ,model)) | |
761 | '()) | |
762 | ,@(if (null? options) | |
763 | '() | |
764 | `(("GUIX_XKB_OPTIONS" | |
765 | ,(string-join options ",")))))))) | |
3ef3bdf1 | 766 | '())) |
607fcc75 LC |
767 | |
768 | (define localed-service-type | |
13615849 LC |
769 | (let ((package (lambda (config) |
770 | ;; Don't bother if the user didn't specify any keyboard | |
771 | ;; layout. | |
772 | (if (localed-configuration-keyboard-layout config) | |
773 | (list (localed-configuration-localed config)) | |
774 | '())))) | |
607fcc75 LC |
775 | (service-type (name 'localed) |
776 | (extensions | |
777 | (list (service-extension dbus-root-service-type | |
778 | localed-dbus-service) | |
779 | (service-extension udev-service-type package) | |
780 | (service-extension polkit-service-type package) | |
781 | ||
782 | ;; Add 'localectl' to the profile. | |
783 | (service-extension profile-service-type package))) | |
784 | ||
785 | ;; This service can be extended, typically by the X login | |
786 | ;; manager, to communicate the chosen Xorg keyboard layout. | |
13615849 LC |
787 | (compose (lambda (extensions) |
788 | (find keyboard-layout? extensions))) | |
607fcc75 LC |
789 | (extend (lambda (config keyboard-layout) |
790 | (localed-configuration | |
791 | (inherit config) | |
792 | (keyboard-layout keyboard-layout)))) | |
793 | (description | |
794 | "Run the locale daemon, @command{localed}, which can be used | |
795 | to control the system locale and keyboard mapping from user programs such as | |
796 | the GNOME desktop environment.") | |
797 | (default-value (localed-configuration))))) | |
798 | ||
799 | \f | |
800 | ;;; | |
801 | ;;; GNOME Desktop Manager. | |
802 | ;;; | |
803 | ||
6e99c01b AW |
804 | (define %gdm-accounts |
805 | (list (user-group (name "gdm") (system? #t)) | |
806 | (user-account | |
807 | (name "gdm") | |
808 | (group "gdm") | |
acb41a40 | 809 | (supplementary-groups '("video")) |
6e99c01b AW |
810 | (system? #t) |
811 | (comment "GNOME Display Manager user") | |
812 | (home-directory "/var/lib/gdm") | |
813 | (shell (file-append shadow "/sbin/nologin"))))) | |
814 | ||
a43e9157 LC |
815 | (define %gdm-activation |
816 | ;; Ensure /var/lib/gdm is owned by the "gdm" user. This is normally the | |
817 | ;; case but could be wrong if the "gdm" user was created, then removed, and | |
818 | ;; then recreated under a different UID/GID: <https://bugs.gnu.org/37423>. | |
819 | (with-imported-modules '((guix build utils)) | |
820 | #~(begin | |
821 | (use-modules (guix build utils)) | |
822 | ||
823 | (let* ((gdm (getpwnam "gdm")) | |
824 | (uid (passwd:uid gdm)) | |
825 | (gid (passwd:gid gdm)) | |
826 | (st (stat "/var/lib/gdm" #f))) | |
827 | ;; Recurse into /var/lib/gdm only if it has wrong ownership. | |
828 | (when (and st | |
829 | (or (not (= uid (stat:uid st))) | |
830 | (not (= gid (stat:gid st))))) | |
831 | (for-each (lambda (file) | |
832 | (chown file uid gid)) | |
833 | (find-files "/var/lib/gdm" | |
834 | #:directories? #t))))))) | |
835 | ||
1f564c15 | 836 | (define dbus-daemon-wrapper |
dcb3a0fe TS |
837 | (program-file |
838 | "gdm-dbus-wrapper" | |
839 | #~(begin | |
840 | (use-modules (srfi srfi-26)) | |
841 | ||
842 | (define system-profile | |
843 | "/run/current-system/profile") | |
844 | ||
845 | (define user-profile | |
846 | (and=> (getpw (getuid)) | |
847 | (lambda (pw) | |
848 | (string-append (passwd:dir pw) "/.guix-profile")))) | |
849 | ||
850 | ;; If we are able to find the user's profile, we can add it to | |
851 | ;; the search paths set below. We need to do this so that D-Bus | |
852 | ;; can start services installed by the user. This allows | |
853 | ;; applications that require session D-Bus services (e.g, | |
854 | ;; 'evolution') to work even if those services are only available | |
855 | ;; in the user's profile. See <https://bugs.gnu.org/35267>. | |
856 | (define profiles | |
857 | (if user-profile | |
858 | (list user-profile system-profile) | |
859 | (list system-profile))) | |
860 | ||
861 | (setenv "XDG_CONFIG_DIRS" | |
862 | (string-join (map (cut string-append <> "/etc/xdg") profiles) | |
863 | ":")) | |
864 | (setenv "XDG_DATA_DIRS" | |
865 | (string-join (map (cut string-append <> "/share") profiles) | |
866 | ":")) | |
867 | (apply execl (string-append #$dbus "/bin/dbus-daemon") | |
868 | (program-arguments))))) | |
1f564c15 | 869 | |
6e99c01b AW |
870 | (define-record-type* <gdm-configuration> |
871 | gdm-configuration make-gdm-configuration | |
872 | gdm-configuration? | |
873 | (gdm gdm-configuration-gdm (default gdm)) | |
874 | (allow-empty-passwords? gdm-configuration-allow-empty-passwords? (default #t)) | |
6e99c01b | 875 | (auto-login? gdm-configuration-auto-login? (default #f)) |
1f564c15 | 876 | (dbus-daemon gdm-configuration-dbus-daemon (default dbus-daemon-wrapper)) |
88f95687 | 877 | (debug? gdm-configuration-debug? (default #f)) |
6e99c01b | 878 | (default-user gdm-configuration-default-user (default #f)) |
7e614198 TS |
879 | (gnome-shell-assets gdm-configuration-gnome-shell-assets |
880 | (default (list adwaita-icon-theme font-cantarell))) | |
554b8607 LC |
881 | (xorg-configuration gdm-configuration-xorg |
882 | (default (xorg-configuration))) | |
41fa9f18 TS |
883 | (x-session gdm-configuration-x-session |
884 | (default (xinitrc)))) | |
6e99c01b | 885 | |
e57c2adb TS |
886 | (define (gdm-configuration-file config) |
887 | (mixed-text-file "gdm-custom.conf" | |
888 | "[daemon]\n" | |
889 | "#User=gdm\n" | |
890 | "#Group=gdm\n" | |
891 | (if (gdm-configuration-auto-login? config) | |
892 | (string-append | |
893 | "AutomaticLoginEnable=true\n" | |
894 | "AutomaticLogin=" | |
895 | (or (gdm-configuration-default-user config) | |
896 | (error "missing default user for auto-login")) | |
897 | "\n") | |
898 | (string-append | |
899 | "AutomaticLoginEnable=false\n" | |
900 | "#AutomaticLogin=\n")) | |
901 | "#TimedLoginEnable=false\n" | |
902 | "#TimedLogin=\n" | |
903 | "#TimedLoginDelay=0\n" | |
9111f975 LP |
904 | ;; Disable initial system setup inside GDM. |
905 | ;; Whatever settings are set there should already be | |
906 | ;; taken care of through `guix system'. | |
907 | ;; See also | |
908 | ;; <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=39281>. | |
909 | "InitialSetupEnable=false\n" | |
e57c2adb TS |
910 | ;; Enable me once X is working. |
911 | "WaylandEnable=false\n" | |
912 | "\n" | |
913 | "[debug]\n" | |
88f95687 TS |
914 | "Enable=" (if (gdm-configuration-debug? config) |
915 | "true" | |
916 | "false") "\n" | |
e57c2adb TS |
917 | "\n" |
918 | "[security]\n" | |
919 | "#DisallowTCP=true\n" | |
920 | "#AllowRemoteAutoLogin=false\n")) | |
6e99c01b AW |
921 | |
922 | (define (gdm-pam-service config) | |
923 | "Return a PAM service for @command{gdm}." | |
924 | (list | |
925 | (pam-service | |
e6b1a224 LC |
926 | (inherit (unix-pam-service "gdm-autologin" |
927 | #:login-uid? #t)) | |
6e99c01b | 928 | (auth (list (pam-entry |
d8258177 | 929 | (control "optional") |
6e99c01b AW |
930 | (module (file-append (gdm-configuration-gdm config) |
931 | "/lib/security/pam_gdm.so"))) | |
932 | (pam-entry | |
933 | (control "sufficient") | |
934 | (module "pam_permit.so"))))) | |
935 | (pam-service | |
936 | (inherit (unix-pam-service "gdm-launch-environment")) | |
937 | (auth (list (pam-entry | |
938 | (control "required") | |
939 | (module "pam_permit.so"))))) | |
de409e82 | 940 | (unix-pam-service "gdm-password" |
e6b1a224 | 941 | #:login-uid? #t |
de409e82 TS |
942 | #:allow-empty-passwords? |
943 | (gdm-configuration-allow-empty-passwords? config)))) | |
6e99c01b AW |
944 | |
945 | (define (gdm-shepherd-service config) | |
946 | (list (shepherd-service | |
947 | (documentation "Xorg display server (GDM)") | |
948 | (provision '(xorg-server)) | |
949 | (requirement '(dbus-system user-processes host-name udev)) | |
6e99c01b AW |
950 | (start #~(lambda () |
951 | (fork+exec-command | |
952 | (list #$(file-append (gdm-configuration-gdm config) | |
953 | "/bin/gdm")) | |
954 | #:environment-variables | |
955 | (list (string-append | |
e57c2adb TS |
956 | "GDM_CUSTOM_CONF=" |
957 | #$(gdm-configuration-file config)) | |
1f564c15 TS |
958 | (string-append |
959 | "GDM_DBUS_DAEMON=" | |
960 | #$(gdm-configuration-dbus-daemon config)) | |
e57c2adb | 961 | (string-append |
6e99c01b | 962 | "GDM_X_SERVER=" |
554b8607 LC |
963 | #$(xorg-wrapper |
964 | (gdm-configuration-xorg config))) | |
41fa9f18 TS |
965 | (string-append |
966 | "GDM_X_SESSION=" | |
967 | #$(gdm-configuration-x-session config)) | |
7e614198 TS |
968 | (string-append |
969 | "XDG_DATA_DIRS=" | |
970 | ((lambda (ls) (string-join ls ":")) | |
971 | (map (lambda (path) | |
972 | (string-append path "/share")) | |
973 | ;; XXX: Remove gnome-shell below when GDM | |
974 | ;; can depend on GNOME Shell directly. | |
975 | (cons #$gnome-shell | |
976 | '#$(gdm-configuration-gnome-shell-assets | |
977 | config))))))))) | |
6e99c01b AW |
978 | (stop #~(make-kill-destructor)) |
979 | (respawn? #t)))) | |
980 | ||
981 | (define gdm-service-type | |
50be0da7 JK |
982 | (handle-xorg-configuration gdm-configuration |
983 | (service-type (name 'gdm) | |
984 | (extensions | |
985 | (list (service-extension shepherd-root-service-type | |
986 | gdm-shepherd-service) | |
987 | (service-extension activation-service-type | |
988 | (const %gdm-activation)) | |
989 | (service-extension account-service-type | |
990 | (const %gdm-accounts)) | |
991 | (service-extension pam-root-service-type | |
992 | gdm-pam-service) | |
993 | (service-extension profile-service-type | |
994 | gdm-configuration-gnome-shell-assets) | |
995 | (service-extension dbus-root-service-type | |
996 | (compose list | |
997 | gdm-configuration-gdm)) | |
998 | (service-extension localed-service-type | |
999 | (compose | |
1000 | xorg-configuration-keyboard-layout | |
1001 | gdm-configuration-xorg)))) | |
1002 | (default-value (gdm-configuration)) | |
1003 | (description | |
1004 | "Run the GNOME Desktop Manager (GDM), a program that allows | |
1005 | you to log in in a graphical session, whether or not you use GNOME.")))) | |
6e99c01b | 1006 | |
65a67bf7 LC |
1007 | (define-deprecated (gdm-service #:key (gdm gdm) |
1008 | (allow-empty-passwords? #t) | |
1009 | (x-server (xorg-wrapper))) | |
1010 | gdm-service-type | |
6e99c01b AW |
1011 | "Return a service that spawns the GDM graphical login manager, which in turn |
1012 | starts the X display server with @var{X}, a command as returned by | |
1013 | @code{xorg-wrapper}. | |
1014 | ||
1015 | @cindex X session | |
1016 | ||
1017 | GDM automatically looks for session types described by the @file{.desktop} | |
1018 | files in @file{/run/current-system/profile/share/xsessions} and allows users | |
1019 | to choose a session from the log-in screen using @kbd{F1}. Packages such as | |
1020 | @var{xfce}, @var{sawfish}, and @var{ratpoison} provide @file{.desktop} files; | |
1021 | adding them to the system-wide set of packages automatically makes them | |
1022 | available at the log-in screen. | |
1023 | ||
1024 | In addition, @file{~/.xsession} files are honored. When available, | |
1025 | @file{~/.xsession} must be an executable that starts a window manager | |
1026 | and/or other X clients. | |
1027 | ||
1028 | When @var{allow-empty-passwords?} is true, allow logins with an empty | |
1029 | password." | |
1030 | (service gdm-service-type | |
1031 | (gdm-configuration | |
1032 | (gdm gdm) | |
554b8607 | 1033 | (allow-empty-passwords? allow-empty-passwords?)))) |
6e99c01b | 1034 | |
305a732a LC |
1035 | (define* (set-xorg-configuration config |
1036 | #:optional | |
1037 | (login-manager-service-type | |
1038 | gdm-service-type)) | |
1039 | "Tell the log-in manager (of type @var{login-manager-service-type}) to use | |
1040 | @var{config}, an <xorg-configuration> record." | |
1041 | (simple-service 'set-xorg-configuration | |
1042 | login-manager-service-type | |
1043 | config)) | |
1044 | ||
db4fdc04 | 1045 | ;;; xorg.scm ends here |