1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2017 Andy Wingo <wingo@igalia.com>
3 ;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2019 Ludovic Courtès <ludo@gnu.org>
4 ;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
5 ;;; Copyright © 2018, 2019 Timothy Sample <samplet@ngyro.com>
6 ;;; Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
7 ;;; Copyright © 2019 Tim Gesthuizen <tim.gesthuizen@yahoo.de>
9 ;;; This file is part of GNU Guix.
11 ;;; GNU Guix is free software; you can redistribute it and/or modify it
12 ;;; under the terms of the GNU General Public License as published by
13 ;;; the Free Software Foundation; either version 3 of the License, or (at
14 ;;; your option) any later version.
16 ;;; GNU Guix is distributed in the hope that it will be useful, but
17 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;;; GNU General Public License for more details.
21 ;;; You should have received a copy of the GNU General Public License
22 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24 (define-module (gnu services xorg)
25 #:use-module (gnu artwork)
26 #:use-module (gnu services)
27 #:use-module (gnu services shepherd)
28 #:use-module (gnu system pam)
29 #:use-module (gnu system keyboard)
30 #:use-module (gnu services base)
31 #:use-module (gnu services dbus)
32 #:use-module ((gnu packages base) #:select (canonical-package))
33 #:use-module (gnu packages guile)
34 #:use-module (gnu packages xorg)
35 #:use-module (gnu packages fonts)
36 #:use-module (gnu packages gl)
37 #:use-module (gnu packages glib)
38 #:use-module (gnu packages display-managers)
39 #:use-module (gnu packages freedesktop)
40 #:use-module (gnu packages gnustep)
41 #:use-module (gnu packages gnome)
42 #:use-module (gnu packages admin)
43 #:use-module (gnu packages bash)
44 #:use-module (gnu system shadow)
45 #:use-module (guix gexp)
46 #:use-module (guix store)
47 #:use-module (guix packages)
48 #:use-module (guix derivations)
49 #:use-module (guix records)
50 #:use-module (guix deprecation)
51 #:use-module (srfi srfi-1)
52 #:use-module (srfi srfi-9)
53 #:use-module (srfi srfi-26)
54 #:use-module (ice-9 match)
55 #:export (xorg-configuration
57 xorg-configuration-modules
58 xorg-configuration-fonts
59 xorg-configuration-drivers
60 xorg-configuration-resolutions
61 xorg-configuration-extra-config
62 xorg-configuration-server
63 xorg-configuration-server-arguments
72 %default-slim-theme-name
76 slim-configuration-slim
77 slim-configuration-allow-empty-passwords?
78 slim-configuration-auto-login?
79 slim-configuration-default-user
80 slim-configuration-theme
81 slim-configuration-theme-name
82 slim-configuration-xauth
83 slim-configuration-shepherd
84 slim-configuration-auto-login-session
85 slim-configuration-xorg
86 slim-configuration-sessreg
93 screen-locker-service-type
97 localed-configuration?
103 set-xorg-configuration))
107 ;;; Services that relate to the X Window System.
111 (define %default-xorg-modules
112 ;; Default list of modules loaded by the server. When multiple drivers
113 ;; match, the first one in the list is loaded.
114 (list xf86-video-vesa
125 ;; Libinput is the new thing and is recommended over evdev/synaptics:
126 ;; <http://who-t.blogspot.fr/2015/01/xf86-input-libinput-compatibility-with.html>.
132 xf86-input-synaptics))
134 (define %default-xorg-fonts
135 ;; Default list of fonts available to the X server.
136 (list (file-append font-alias "/share/fonts/X11/75dpi")
137 (file-append font-alias "/share/fonts/X11/100dpi")
138 (file-append font-alias "/share/fonts/X11/misc")
139 (file-append font-alias "/share/fonts/X11/cyrillic")
140 (file-append font-misc-misc ;default fonts for xterm
141 "/share/fonts/X11/misc")
142 (file-append font-adobe75dpi "/share/fonts/X11/75dpi")))
144 (define %default-xorg-server-arguments
145 ;; Default command-line arguments for X.
146 '("-nolisten" "tcp"))
148 ;; Configuration of an Xorg server.
149 (define-record-type* <xorg-configuration>
150 xorg-configuration make-xorg-configuration
152 (modules xorg-configuration-modules ;list of packages
153 (default %default-xorg-modules))
154 (fonts xorg-configuration-fonts ;list of packges
155 (default %default-xorg-fonts))
156 (drivers xorg-configuration-drivers ;list of strings
158 (resolutions xorg-configuration-resolutions ;list of tuples
160 (keyboard-layout xorg-configuration-keyboard-layout ;#f | <keyboard-layout>
162 (extra-config xorg-configuration-extra-config ;list of strings
164 (server xorg-configuration-server ;package
165 (default xorg-server))
166 (server-arguments xorg-configuration-server-arguments ;list of strings
167 (default %default-xorg-server-arguments)))
169 (define (xorg-configuration->file config)
170 "Compute an Xorg configuration file corresponding to CONFIG, an
171 <xorg-configuration> record."
173 ;; 'xorg-server' provides 'fbdevhw.so' etc.
174 (append (xorg-configuration-modules config)
179 (use-modules (ice-9 match)
183 (call-with-output-file #$output
186 '#$(xorg-configuration-drivers config))
188 (define (device-section driver)
191 Identifier \"device-" driver "\"
192 Driver \"" driver "\"
195 (define (screen-section driver resolutions)
198 Identifier \"screen-" driver "\"
199 Device \"device-" driver "\"
200 SubSection \"Display\"
202 (string-join (map (match-lambda
204 (string-append "\"" (number->string x)
205 "x" (number->string y) "\"")))
210 (define (input-class-section layout variant model options)
212 Section \"InputClass\"
213 Identifier \"evdev keyboard catchall\"
214 MatchIsKeyboard \"on\"
215 Option \"XkbLayout\" " (object->string layout)
217 (string-append " Option \"XkbVariant\" \""
221 (string-append " Option \"XkbModel\" \""
228 (string-append " Option \"XkbOptions\" \""
229 (string-join options ",") "\""))) "
231 MatchDevicePath \"/dev/input/event*\"
235 (define (expand modules)
236 ;; Append to MODULES the relevant /lib/xorg/modules
238 (append-map (lambda (module)
239 (filter-map (lambda (directory)
240 (let ((full (string-append module
242 (and (file-exists? full)
244 '("/lib/xorg/modules/drivers"
245 "/lib/xorg/modules/input"
246 "/lib/xorg/modules/multimedia"
247 "/lib/xorg/modules/extensions")))
250 (display "Section \"Files\"\n" port)
251 (for-each (lambda (font)
252 (format port " FontPath \"~a\"~%" font))
253 '#$(xorg-configuration-fonts config))
254 (for-each (lambda (module)
256 " ModulePath \"~a\"~%"
258 (append (expand '#$all-modules)
260 ;; For fbdevhw.so and so on.
261 (list #$(file-append xorg-server
262 "/lib/xorg/modules"))))
263 (display "EndSection\n" port)
265 Section \"ServerFlags\"
266 Option \"AllowMouseOpenFail\" \"on\"
269 (display (string-join (map device-section drivers) "\n")
272 (display (string-join
273 (map (cut screen-section <>
274 '#$(xorg-configuration-resolutions config))
280 (let ((layout #$(and=> (xorg-configuration-keyboard-layout config)
281 keyboard-layout-name))
282 (variant #$(and=> (xorg-configuration-keyboard-layout config)
283 keyboard-layout-variant))
284 (model #$(and=> (xorg-configuration-keyboard-layout config)
285 keyboard-layout-model))
286 (options '#$(and=> (xorg-configuration-keyboard-layout config)
287 keyboard-layout-options)))
289 (display (input-class-section layout variant model options)
293 (for-each (lambda (config)
294 (display config port))
295 '#$(xorg-configuration-extra-config config))))))
297 (computed-file "xserver.conf" build))
299 (define (xorg-configuration-directory modules)
300 "Return a directory that contains the @code{.conf} files for X.org that
301 includes the @code{share/X11/xorg.conf.d} directories of each package listed
303 (with-imported-modules '((guix build utils))
304 (computed-file "xorg.conf.d"
306 (use-modules (guix build utils)
310 (append-map (lambda (module)
311 (find-files (string-append
313 "/share/X11/xorg.conf.d")
318 (for-each (lambda (file)
320 (string-append #$output "/"
325 (define* (xorg-wrapper #:optional (config (xorg-configuration)))
326 "Return a derivation that builds a script to start the X server with the
327 given @var{config}. The resulting script should be used in place of
330 ;; Write a small wrapper around the X server.
332 (setenv "XORG_DRI_DRIVER_PATH" (string-append #$mesa "/lib/dri"))
333 (setenv "XKB_BINDIR" (string-append #$xkbcomp "/bin"))
335 (let ((X (string-append #$(xorg-configuration-server config) "/bin/X")))
337 "-xkbdir" (string-append #$xkeyboard-config "/share/X11/xkb")
338 "-config" #$(xorg-configuration->file config)
339 "-configdir" #$(xorg-configuration-directory
340 (xorg-configuration-modules config))
341 (cdr (command-line))))))
343 (program-file "X-wrapper" exp))
345 (define* (xorg-start-command #:optional (config (xorg-configuration)))
346 "Return a @code{startx} script in which the modules, fonts, etc. specified
347 in @var{config}, are available. The result should be used in place of
350 (xorg-wrapper config))
353 ;; Write a small wrapper around the X server.
354 #~(apply execl #$X #$X ;; Second #$X is for argv[0].
355 "-logverbose" "-verbose" "-terminate"
356 #$@(xorg-configuration-server-arguments config)
357 (cdr (command-line))))
359 (program-file "startx" exp))
361 (define* (xinitrc #:key fallback-session)
362 "Return a system-wide xinitrc script that starts the specified X session,
363 which should be passed to this script as the first argument. If not, the
364 @var{fallback-session} will be used or, if @var{fallback-session} is false, a
365 desktop session from the system or user profile will be used."
368 (use-modules (ice-9 match)
375 (define (close-all-fdes)
376 ;; Close all the open file descriptors except 0 to 2.
378 (when (< fd 4096) ;FIXME: use sysconf + _SC_OPEN_MAX
379 (false-if-exception (close-fdes fd))
382 (define (exec-from-login-shell command . args)
383 ;; Run COMMAND from a login shell so that it gets to see the same
384 ;; environment variables that one gets when logging in on a tty, for
386 (let* ((pw (getpw (getuid)))
387 (shell (passwd:shell pw)))
388 ;; Close any open file descriptors. This is all the more
389 ;; important that SLiM itself exec's us directly without closing
390 ;; its own file descriptors!
393 ;; The '--login' option is supported at least by Bash and zsh.
394 (execl shell shell "--login" "-c"
395 (string-join (cons command args)))))
397 (define system-profile
398 "/run/current-system/profile")
401 (and=> (getpw (getuid))
403 (string-append (passwd:dir pw) "/.guix-profile"))))
405 (define (xsession-command desktop-file)
406 ;; Read from DESKTOP-FILE its X session command and return it as a
409 (make-regexp "^[[:blank:]]*Exec=(.*)$"))
411 (call-with-input-file desktop-file
414 (match (read-line port)
416 ((= (cut regexp-exec exec-regexp <>) result)
418 (string-tokenize (match:substring result 1))
421 (define (find-session profile)
422 ;; Return an X session command from PROFILE or #f if none was found.
423 (let ((directory (string-append profile "/share/xsessions")))
424 (match (scandir directory
425 (cut string-suffix? ".desktop" <>))
429 (any xsession-command
430 (map (cut string-append directory "/" <>)
433 (let* ((home (getenv "HOME"))
434 (xsession-file (string-append home "/.xsession"))
435 (session (match (command-line)
437 #$(if fallback-session
438 #~(list #$fallback-session)
442 (if (file-exists? xsession-file)
443 ;; Run ~/.xsession when it exists.
444 (apply exec-from-login-shell xsession-file
446 ;; Otherwise, start the specified session or a fallback.
447 (apply exec-from-login-shell
449 (find-session user-profile)
450 (find-session system-profile)))))))
452 (program-file "xinitrc" builder))
456 ;;; SLiM log-in manager.
459 (define %default-slim-theme
460 ;; Theme based on work by Felipe López.
461 (file-append %artwork-repository "/slim"))
463 (define %default-slim-theme-name
464 ;; This must be the name of the sub-directory in %DEFAULT-SLIM-THEME that
465 ;; contains the actual theme files.
468 (define-record-type* <slim-configuration>
469 slim-configuration make-slim-configuration
471 (slim slim-configuration-slim
473 (allow-empty-passwords? slim-configuration-allow-empty-passwords?
475 (auto-login? slim-configuration-auto-login?
477 (default-user slim-configuration-default-user
479 (theme slim-configuration-theme
480 (default %default-slim-theme))
481 (theme-name slim-configuration-theme-name
482 (default %default-slim-theme-name))
483 (xauth slim-configuration-xauth
485 (shepherd slim-configuration-shepherd
487 (auto-login-session slim-configuration-auto-login-session
489 (xorg-configuration slim-configuration-xorg
490 (default (xorg-configuration)))
491 (sessreg slim-configuration-sessreg
494 (define (slim-pam-service config)
495 "Return a PAM service for @command{slim}."
496 (list (unix-pam-service
498 #:allow-empty-passwords?
499 (slim-configuration-allow-empty-passwords? config))))
501 (define (slim-shepherd-service config)
503 (let ((xinitrc (xinitrc #:fallback-session
504 (slim-configuration-auto-login-session config)))
505 (xauth (slim-configuration-xauth config))
506 (startx (xorg-start-command (slim-configuration-xorg config)))
507 (shepherd (slim-configuration-shepherd config))
508 (theme-name (slim-configuration-theme-name config))
509 (sessreg (slim-configuration-sessreg config)))
510 (mixed-text-file "slim.cfg" "
511 default_path /run/current-system/profile/bin
512 default_xserver " startx "
513 xserver_arguments :0 vt7
514 xauth_path " xauth "/bin/xauth
515 authfile /var/run/slim.auth
517 # The login command. '%session' is replaced by the chosen session name, one
518 # of the names specified in the 'sessions' setting: 'wmaker', 'xfce', etc.
519 login_cmd exec " xinitrc " %session
520 sessiondir /run/current-system/profile/share/xsessions
521 session_msg session (F1 to change):
522 sessionstart_cmd " sessreg "/bin/sessreg -a -l $DISPLAY %user
523 sessionstop_cmd " sessreg "/bin/sessreg -d -l $DISPLAY %user
525 halt_cmd " shepherd "/sbin/halt
526 reboot_cmd " shepherd "/sbin/reboot\n"
527 (if (slim-configuration-auto-login? config)
528 (string-append "auto_login yes\ndefault_user "
529 (slim-configuration-default-user config) "\n")
532 (string-append "current_theme " theme-name "\n")
536 (slim-configuration-theme config))
538 (list (shepherd-service
539 (documentation "Xorg display server")
540 (provision '(xorg-server))
541 (requirement '(user-processes host-name udev))
544 ;; A stale lock file can prevent SLiM from starting, so remove it to
545 ;; be on the safe side.
546 (false-if-exception (delete-file "/var/run/slim.lock"))
549 (list (string-append #$(slim-configuration-slim config)
552 #:environment-variables
553 (list (string-append "SLIM_CFGFILE=" #$slim.cfg)
555 (list #~(string-append "SLIM_THEMESDIR=" #$theme))
557 (stop #~(make-kill-destructor))
560 (define slim-service-type
561 (service-type (name 'slim)
563 (list (service-extension shepherd-root-service-type
564 slim-shepherd-service)
565 (service-extension pam-root-service-type
568 ;; Unconditionally add xterm to the system profile, to
569 ;; avoid bad surprises.
570 (service-extension profile-service-type
571 (const (list xterm)))))
572 (default-value (slim-configuration))))
574 (define-deprecated (slim-service #:key (slim slim)
575 (allow-empty-passwords? #t) auto-login?
577 (theme %default-slim-theme)
578 (theme-name %default-slim-theme-name)
579 (xauth xauth) (shepherd shepherd)
580 (auto-login-session #f)
581 (startx (xorg-start-command)))
583 "Return a service that spawns the SLiM graphical login manager, which in
584 turn starts the X display server with @var{startx}, a command as returned by
585 @code{xorg-start-command}.
589 SLiM automatically looks for session types described by the @file{.desktop}
590 files in @file{/run/current-system/profile/share/xsessions} and allows users
591 to choose a session from the log-in screen using @kbd{F1}. Packages such as
592 @var{xfce}, @var{sawfish}, and @var{ratpoison} provide @file{.desktop} files;
593 adding them to the system-wide set of packages automatically makes them
594 available at the log-in screen.
596 In addition, @file{~/.xsession} files are honored. When available,
597 @file{~/.xsession} must be an executable that starts a window manager
598 and/or other X clients.
600 When @var{allow-empty-passwords?} is true, allow logins with an empty
601 password. When @var{auto-login?} is true, log in automatically as
602 @var{default-user} with @var{auto-login-session}.
604 If @var{theme} is @code{#f}, the use the default log-in theme; otherwise
605 @var{theme} must be a gexp denoting the name of a directory containing the
606 theme to use. In that case, @var{theme-name} specifies the name of the
608 (service slim-service-type
611 (allow-empty-passwords? allow-empty-passwords?)
612 (auto-login? auto-login?) (default-user default-user)
613 (theme theme) (theme-name theme-name)
614 (xauth xauth) (shepherd shepherd)
615 (auto-login-session auto-login-session))))
619 ;;; Screen lockers & co.
622 (define-record-type <screen-locker>
623 (screen-locker name program empty?)
625 (name screen-locker-name) ;string
626 (program screen-locker-program) ;gexp
627 (empty? screen-locker-allows-empty-passwords?)) ;Boolean
629 (define screen-locker-pam-services
631 (($ <screen-locker> name _ empty?)
632 (list (unix-pam-service name
633 #:allow-empty-passwords? empty?)))))
635 (define screen-locker-setuid-programs
636 (compose list screen-locker-program))
638 (define screen-locker-service-type
639 (service-type (name 'screen-locker)
641 (list (service-extension pam-root-service-type
642 screen-locker-pam-services)
643 (service-extension setuid-program-service-type
644 screen-locker-setuid-programs)))))
646 (define* (screen-locker-service package
648 (program (package-name package))
649 #:key allow-empty-passwords?)
650 "Add @var{package}, a package for a screen locker or screen saver whose
651 command is @var{program}, to the set of setuid programs and add a PAM entry
655 (screen-locker-service xlockmore \"xlock\")
658 makes the good ol' XlockMore usable."
659 (service screen-locker-service-type
660 (screen-locker program
661 (file-append package "/bin/" program)
662 allow-empty-passwords?)))
669 (define-record-type* <localed-configuration>
670 localed-configuration make-localed-configuration
671 localed-configuration?
672 (localed localed-configuration-localed
674 (keyboard-layout localed-configuration-keyboard-layout
677 (define (localed-dbus-service config)
678 "Return the 'localed' D-Bus service for @var{config}, a
679 @code{<localed-configuration>} record."
680 (define keyboard-layout
681 (localed-configuration-keyboard-layout config))
683 ;; The primary purpose of 'localed' is to tell GDM what the "current" Xorg
684 ;; keyboard layout is. If 'localed' is missing, or if it's unable to
685 ;; determine the current XKB layout, then GDM forcefully installs its
686 ;; default XKB config (US English). Here we communicate the configured
687 ;; layout through environment variables.
690 (let* ((layout (keyboard-layout-name keyboard-layout))
691 (variant (keyboard-layout-variant keyboard-layout))
692 (model (keyboard-layout-model keyboard-layout))
693 (options (keyboard-layout-options keyboard-layout)))
694 (list (wrapped-dbus-service
695 (localed-configuration-localed config)
696 "libexec/localed/localed"
697 `(("GUIX_XKB_LAYOUT" ,layout)
699 `(("GUIX_XKB_VARIANT" ,variant))
702 `(("GUIX_XKB_MODEL" ,model))
704 ,@(if (null? options)
706 `(("GUIX_XKB_OPTIONS"
707 ,(string-join options ","))))))))
710 (define localed-service-type
711 (let ((package (lambda (config)
712 ;; Don't bother if the user didn't specify any keyboard
714 (if (localed-configuration-keyboard-layout config)
715 (list (localed-configuration-localed config))
717 (service-type (name 'localed)
719 (list (service-extension dbus-root-service-type
720 localed-dbus-service)
721 (service-extension udev-service-type package)
722 (service-extension polkit-service-type package)
724 ;; Add 'localectl' to the profile.
725 (service-extension profile-service-type package)))
727 ;; This service can be extended, typically by the X login
728 ;; manager, to communicate the chosen Xorg keyboard layout.
729 (compose (lambda (extensions)
730 (find keyboard-layout? extensions)))
731 (extend (lambda (config keyboard-layout)
732 (localed-configuration
734 (keyboard-layout keyboard-layout))))
736 "Run the locale daemon, @command{localed}, which can be used
737 to control the system locale and keyboard mapping from user programs such as
738 the GNOME desktop environment.")
739 (default-value (localed-configuration)))))
743 ;;; GNOME Desktop Manager.
746 (define %gdm-accounts
747 (list (user-group (name "gdm") (system? #t))
752 (comment "GNOME Display Manager user")
753 (home-directory "/var/lib/gdm")
754 (shell (file-append shadow "/sbin/nologin")))))
756 (define dbus-daemon-wrapper
757 (program-file "gdm-dbus-wrapper"
759 (setenv "XDG_CONFIG_DIRS"
760 "/run/current-system/profile/etc/xdg")
761 (setenv "XDG_DATA_DIRS"
762 "/run/current-system/profile/share")
763 (apply execl (string-append #$dbus "/bin/dbus-daemon")
764 (program-arguments)))))
766 (define-record-type* <gdm-configuration>
767 gdm-configuration make-gdm-configuration
769 (gdm gdm-configuration-gdm (default gdm))
770 (allow-empty-passwords? gdm-configuration-allow-empty-passwords? (default #t))
771 (auto-login? gdm-configuration-auto-login? (default #f))
772 (dbus-daemon gdm-configuration-dbus-daemon (default dbus-daemon-wrapper))
773 (default-user gdm-configuration-default-user (default #f))
774 (gnome-shell-assets gdm-configuration-gnome-shell-assets
775 (default (list adwaita-icon-theme font-cantarell)))
776 (xorg-configuration gdm-configuration-xorg
777 (default (xorg-configuration)))
778 (x-session gdm-configuration-x-session
779 (default (xinitrc))))
781 (define (gdm-configuration-file config)
782 (mixed-text-file "gdm-custom.conf"
786 (if (gdm-configuration-auto-login? config)
788 "AutomaticLoginEnable=true\n"
790 (or (gdm-configuration-default-user config)
791 (error "missing default user for auto-login"))
794 "AutomaticLoginEnable=false\n"
795 "#AutomaticLogin=\n"))
796 "#TimedLoginEnable=false\n"
798 "#TimedLoginDelay=0\n"
799 "#InitialSetupEnable=true\n"
800 ;; Enable me once X is working.
801 "WaylandEnable=false\n"
807 "#DisallowTCP=true\n"
808 "#AllowRemoteAutoLogin=false\n"))
810 (define (gdm-pam-service config)
811 "Return a PAM service for @command{gdm}."
814 (inherit (unix-pam-service "gdm-autologin"))
815 (auth (list (pam-entry
816 (control "[success=ok default=1]")
817 (module (file-append (gdm-configuration-gdm config)
818 "/lib/security/pam_gdm.so")))
820 (control "sufficient")
821 (module "pam_permit.so")))))
823 (inherit (unix-pam-service "gdm-launch-environment"))
824 (auth (list (pam-entry
826 (module "pam_permit.so")))))
827 (unix-pam-service "gdm-password"
828 #:allow-empty-passwords?
829 (gdm-configuration-allow-empty-passwords? config))))
831 (define (gdm-shepherd-service config)
832 (list (shepherd-service
833 (documentation "Xorg display server (GDM)")
834 (provision '(xorg-server))
835 (requirement '(dbus-system user-processes host-name udev))
838 (list #$(file-append (gdm-configuration-gdm config)
840 #:environment-variables
843 #$(gdm-configuration-file config))
846 #$(gdm-configuration-dbus-daemon config))
850 (gdm-configuration-xorg config)))
853 #$(gdm-configuration-x-session config))
856 ((lambda (ls) (string-join ls ":"))
858 (string-append path "/share"))
859 ;; XXX: Remove gnome-shell below when GDM
860 ;; can depend on GNOME Shell directly.
862 '#$(gdm-configuration-gnome-shell-assets
864 (stop #~(make-kill-destructor))
867 (define gdm-service-type
868 (service-type (name 'gdm)
870 (list (service-extension shepherd-root-service-type
871 gdm-shepherd-service)
872 (service-extension account-service-type
873 (const %gdm-accounts))
874 (service-extension pam-root-service-type
876 (service-extension profile-service-type
877 gdm-configuration-gnome-shell-assets)
878 (service-extension dbus-root-service-type
880 gdm-configuration-gdm))
881 (service-extension localed-service-type
883 xorg-configuration-keyboard-layout
884 gdm-configuration-xorg))))
886 ;; For convenience, this service can be extended with an
887 ;; <xorg-configuration> record. Take the first one that
889 (compose (lambda (extensions)
892 ((config . _) config))))
893 (extend (lambda (config xorg-configuration)
894 (if xorg-configuration
897 (xorg-configuration xorg-configuration))
900 (default-value (gdm-configuration))
902 "Run the GNOME Desktop Manager (GDM), a program that allows
903 you to log in in a graphical session, whether or not you use GNOME.")))
905 (define-deprecated (gdm-service #:key (gdm gdm)
906 (allow-empty-passwords? #t)
907 (x-server (xorg-wrapper)))
909 "Return a service that spawns the GDM graphical login manager, which in turn
910 starts the X display server with @var{X}, a command as returned by
915 GDM automatically looks for session types described by the @file{.desktop}
916 files in @file{/run/current-system/profile/share/xsessions} and allows users
917 to choose a session from the log-in screen using @kbd{F1}. Packages such as
918 @var{xfce}, @var{sawfish}, and @var{ratpoison} provide @file{.desktop} files;
919 adding them to the system-wide set of packages automatically makes them
920 available at the log-in screen.
922 In addition, @file{~/.xsession} files are honored. When available,
923 @file{~/.xsession} must be an executable that starts a window manager
924 and/or other X clients.
926 When @var{allow-empty-passwords?} is true, allow logins with an empty
928 (service gdm-service-type
931 (allow-empty-passwords? allow-empty-passwords?))))
933 (define* (set-xorg-configuration config
935 (login-manager-service-type
937 "Tell the log-in manager (of type @var{login-manager-service-type}) to use
938 @var{config}, an <xorg-configuration> record."
939 (simple-service 'set-xorg-configuration
940 login-manager-service-type
943 ;;; xorg.scm ends here