xorg.scm 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2017 Andy Wingo <wingo@igalia.com>
  3. ;;; Copyright © 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
  4. ;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
  5. ;;;
  6. ;;; This file is part of GNU Guix.
  7. ;;;
  8. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  9. ;;; under the terms of the GNU General Public License as published by
  10. ;;; the Free Software Foundation; either version 3 of the License, or (at
  11. ;;; your option) any later version.
  12. ;;;
  13. ;;; GNU Guix is distributed in the hope that it will be useful, but
  14. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  15. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. ;;; GNU General Public License for more details.
  17. ;;;
  18. ;;; You should have received a copy of the GNU General Public License
  19. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  20. (define-module (gnu services xorg)
  21. #:use-module (gnu artwork)
  22. #:use-module (gnu services)
  23. #:use-module (gnu services shepherd)
  24. #:use-module (gnu system pam)
  25. #:use-module (gnu services dbus)
  26. #:use-module ((gnu packages base) #:select (canonical-package))
  27. #:use-module (gnu packages guile)
  28. #:use-module (gnu packages xorg)
  29. #:use-module (gnu packages gl)
  30. #:use-module (gnu packages display-managers)
  31. #:use-module (gnu packages gnustep)
  32. #:use-module (gnu packages gnome)
  33. #:use-module (gnu packages admin)
  34. #:use-module (gnu packages bash)
  35. #:use-module (gnu system shadow)
  36. #:use-module (guix gexp)
  37. #:use-module (guix store)
  38. #:use-module (guix packages)
  39. #:use-module (guix derivations)
  40. #:use-module (guix records)
  41. #:use-module (srfi srfi-1)
  42. #:use-module (srfi srfi-9)
  43. #:use-module (srfi srfi-26)
  44. #:use-module (ice-9 match)
  45. #:export (xorg-configuration-file
  46. %default-xorg-modules
  47. xorg-wrapper
  48. xorg-start-command
  49. xinitrc
  50. %default-slim-theme
  51. %default-slim-theme-name
  52. slim-configuration
  53. slim-service-type
  54. slim-service
  55. screen-locker
  56. screen-locker?
  57. screen-locker-service-type
  58. screen-locker-service
  59. gdm-configuration
  60. gdm-service-type
  61. gdm-service))
  62. ;;; Commentary:
  63. ;;;
  64. ;;; Services that relate to the X Window System.
  65. ;;;
  66. ;;; Code:
  67. (define* (xorg-configuration-file #:key (drivers '()) (resolutions '())
  68. (extra-config '()))
  69. "Return a configuration file for the Xorg server containing search paths for
  70. all the common drivers.
  71. @var{drivers} must be either the empty list, in which case Xorg chooses a
  72. graphics driver automatically, or a list of driver names that will be tried in
  73. this order---e.g., @code{(\"modesetting\" \"vesa\")}.
  74. Likewise, when @var{resolutions} is the empty list, Xorg chooses an
  75. appropriate screen resolution; otherwise, it must be a list of
  76. resolutions---e.g., @code{((1024 768) (640 480))}.
  77. Last, @var{extra-config} is a list of strings or objects appended to the
  78. @code{mixed-text-file} argument list. It is used to pass extra text to be
  79. added verbatim to the configuration file."
  80. (define (device-section driver)
  81. (string-append "
  82. Section \"Device\"
  83. Identifier \"device-" driver "\"
  84. Driver \"" driver "\"
  85. EndSection"))
  86. (define (screen-section driver resolutions)
  87. (string-append "
  88. Section \"Screen\"
  89. Identifier \"screen-" driver "\"
  90. Device \"device-" driver "\"
  91. SubSection \"Display\"
  92. Modes "
  93. (string-join (map (match-lambda
  94. ((x y)
  95. (string-append "\"" (number->string x)
  96. "x" (number->string y) "\"")))
  97. resolutions)) "
  98. EndSubSection
  99. EndSection"))
  100. (apply mixed-text-file "xserver.conf" "
  101. Section \"Files\"
  102. FontPath \"" font-alias "/share/fonts/X11/75dpi\"
  103. FontPath \"" font-alias "/share/fonts/X11/100dpi\"
  104. FontPath \"" font-alias "/share/fonts/X11/misc\"
  105. FontPath \"" font-alias "/share/fonts/X11/cyrillic\"
  106. FontPath \"" font-adobe75dpi "/share/fonts/X11/75dpi\"
  107. ModulePath \"" xf86-video-vesa "/lib/xorg/modules/drivers\"
  108. ModulePath \"" xf86-video-fbdev "/lib/xorg/modules/drivers\"
  109. ModulePath \"" xf86-video-ati "/lib/xorg/modules/drivers\"
  110. ModulePath \"" xf86-video-cirrus "/lib/xorg/modules/drivers\"
  111. ModulePath \"" xf86-video-intel "/lib/xorg/modules/drivers\"
  112. ModulePath \"" xf86-video-mach64 "/lib/xorg/modules/drivers\"
  113. ModulePath \"" xf86-video-nouveau "/lib/xorg/modules/drivers\"
  114. ModulePath \"" xf86-video-nv "/lib/xorg/modules/drivers\"
  115. ModulePath \"" xf86-video-sis "/lib/xorg/modules/drivers\"
  116. # Libinput is the new thing and is recommended over evdev/synaptics
  117. # by those who know:
  118. # <http://who-t.blogspot.fr/2015/01/xf86-input-libinput-compatibility-with.html>.
  119. ModulePath \"" xf86-input-libinput "/lib/xorg/modules/input\"
  120. ModulePath \"" xf86-input-evdev "/lib/xorg/modules/input\"
  121. ModulePath \"" xf86-input-keyboard "/lib/xorg/modules/input\"
  122. ModulePath \"" xf86-input-mouse "/lib/xorg/modules/input\"
  123. ModulePath \"" xf86-input-synaptics "/lib/xorg/modules/input\"
  124. ModulePath \"" xorg-server "/lib/xorg/modules\"
  125. ModulePath \"" xorg-server "/lib/xorg/modules/drivers\"
  126. ModulePath \"" xorg-server "/lib/xorg/modules/extensions\"
  127. ModulePath \"" xorg-server "/lib/xorg/modules/multimedia\"
  128. EndSection
  129. Section \"ServerFlags\"
  130. Option \"AllowMouseOpenFail\" \"on\"
  131. EndSection
  132. "
  133. (string-join (map device-section drivers) "\n") "\n"
  134. (string-join (map (cut screen-section <> resolutions)
  135. drivers)
  136. "\n")
  137. "\n"
  138. extra-config))
  139. (define %default-xorg-modules
  140. (list xf86-video-vesa
  141. xf86-video-fbdev
  142. xf86-video-ati
  143. xf86-video-cirrus
  144. xf86-video-intel
  145. xf86-video-mach64
  146. xf86-video-nouveau
  147. xf86-video-nv
  148. xf86-video-sis
  149. xf86-input-libinput
  150. xf86-input-evdev
  151. xf86-input-keyboard
  152. xf86-input-mouse
  153. xf86-input-synaptics))
  154. (define (xorg-configuration-directory modules)
  155. "Return a directory that contains the @code{.conf} files for X.org that
  156. includes the @code{share/X11/xorg.conf.d} directories of each package listed
  157. in @var{modules}."
  158. (with-imported-modules '((guix build utils))
  159. (computed-file "xorg.conf.d"
  160. #~(begin
  161. (use-modules (guix build utils)
  162. (srfi srfi-1))
  163. (define files
  164. (append-map (lambda (module)
  165. (find-files (string-append
  166. module
  167. "/share/X11/xorg.conf.d")
  168. "\\.conf$"))
  169. (list #$@modules)))
  170. (mkdir #$output)
  171. (for-each (lambda (file)
  172. (symlink file
  173. (string-append #$output "/"
  174. (basename file))))
  175. files)
  176. #t))))
  177. (define* (xorg-wrapper #:key
  178. (guile (canonical-package guile-2.0))
  179. (configuration-file (xorg-configuration-file))
  180. (modules %default-xorg-modules)
  181. (xorg-server xorg-server))
  182. "Return a derivation that builds a @var{guile} script to start the X server
  183. from @var{xorg-server}. @var{configuration-file} is the server configuration
  184. file or a derivation that builds it; when omitted, the result of
  185. @code{xorg-configuration-file} is used. The resulting script should be used
  186. in place of @code{/usr/bin/X}."
  187. (define exp
  188. ;; Write a small wrapper around the X server.
  189. #~(begin
  190. (setenv "XORG_DRI_DRIVER_PATH" (string-append #$mesa "/lib/dri"))
  191. (setenv "XKB_BINDIR" (string-append #$xkbcomp "/bin"))
  192. (let ((X (string-append #$xorg-server "/bin/X")))
  193. (apply execl X X
  194. "-xkbdir" (string-append #$xkeyboard-config "/share/X11/xkb")
  195. "-config" #$configuration-file
  196. "-configdir" #$(xorg-configuration-directory modules)
  197. (cdr (command-line))))))
  198. (program-file "X-wrapper" exp))
  199. (define* (xorg-start-command #:key
  200. (guile (canonical-package guile-2.0))
  201. (configuration-file (xorg-configuration-file))
  202. (modules %default-xorg-modules)
  203. (xorg-server xorg-server))
  204. "Return a derivation that builds a @code{startx} script in which a number of
  205. X modules are available. See @code{xorg-wrapper} for more details on the
  206. arguments. The result should be used in place of @code{startx}."
  207. (define X
  208. (xorg-wrapper #:guile guile
  209. #:configuration-file configuration-file
  210. #:modules modules
  211. #:xorg-server xorg-server))
  212. (define exp
  213. ;; Write a small wrapper around the X server.
  214. #~(apply execl #$X #$X ;; Second #$X is for argv[0].
  215. "-logverbose" "-verbose" "-nolisten" "tcp" "-terminate"
  216. (cdr (command-line))))
  217. (program-file "startx" exp))
  218. (define* (xinitrc #:key
  219. (guile (canonical-package guile-2.0))
  220. fallback-session)
  221. "Return a system-wide xinitrc script that starts the specified X session,
  222. which should be passed to this script as the first argument. If not, the
  223. @var{fallback-session} will be used."
  224. (define builder
  225. #~(begin
  226. (use-modules (ice-9 match))
  227. (define (close-all-fdes)
  228. ;; Close all the open file descriptors except 0 to 2.
  229. (let loop ((fd 3))
  230. (when (< fd 4096) ;FIXME: use sysconf + _SC_OPEN_MAX
  231. (false-if-exception (close-fdes fd))
  232. (loop (+ 1 fd)))))
  233. (define (exec-from-login-shell command . args)
  234. ;; Run COMMAND from a login shell so that it gets to see the same
  235. ;; environment variables that one gets when logging in on a tty, for
  236. ;; instance.
  237. (let* ((pw (getpw (getuid)))
  238. (shell (passwd:shell pw)))
  239. ;; Close any open file descriptors. This is all the more
  240. ;; important that SLiM itself exec's us directly without closing
  241. ;; its own file descriptors!
  242. (close-all-fdes)
  243. ;; The '--login' option is supported at least by Bash and zsh.
  244. (execl shell shell "--login" "-c"
  245. (string-join (cons command args)))))
  246. (let* ((home (getenv "HOME"))
  247. (xsession-file (string-append home "/.xsession"))
  248. (session (match (command-line)
  249. ((_) (list #$fallback-session))
  250. ((_ x ..1) x))))
  251. (if (file-exists? xsession-file)
  252. ;; Run ~/.xsession when it exists.
  253. (apply exec-from-login-shell xsession-file session)
  254. ;; Otherwise, start the specified session.
  255. (apply exec-from-login-shell session)))))
  256. (program-file "xinitrc" builder))
  257. ;;;
  258. ;;; SLiM log-in manager.
  259. ;;;
  260. (define %default-slim-theme
  261. ;; Theme based on work by Felipe López.
  262. (file-append %artwork-repository "/slim"))
  263. (define %default-slim-theme-name
  264. ;; This must be the name of the sub-directory in %DEFAULT-SLIM-THEME that
  265. ;; contains the actual theme files.
  266. "0.x")
  267. (define-record-type* <slim-configuration>
  268. slim-configuration make-slim-configuration
  269. slim-configuration?
  270. (slim slim-configuration-slim
  271. (default slim))
  272. (allow-empty-passwords? slim-configuration-allow-empty-passwords?)
  273. (auto-login? slim-configuration-auto-login?)
  274. (default-user slim-configuration-default-user)
  275. (theme slim-configuration-theme)
  276. (theme-name slim-configuration-theme-name)
  277. (xauth slim-configuration-xauth
  278. (default xauth))
  279. (shepherd slim-configuration-shepherd
  280. (default shepherd))
  281. (bash slim-configuration-bash
  282. (default bash))
  283. (auto-login-session slim-configuration-auto-login-session)
  284. (startx slim-configuration-startx))
  285. (define (slim-pam-service config)
  286. "Return a PAM service for @command{slim}."
  287. (list (unix-pam-service
  288. "slim"
  289. #:allow-empty-passwords?
  290. (slim-configuration-allow-empty-passwords? config))))
  291. (define (slim-shepherd-service config)
  292. (define slim.cfg
  293. (let ((xinitrc (xinitrc #:fallback-session
  294. (slim-configuration-auto-login-session config)))
  295. (slim (slim-configuration-slim config))
  296. (xauth (slim-configuration-xauth config))
  297. (startx (slim-configuration-startx config))
  298. (shepherd (slim-configuration-shepherd config))
  299. (theme-name (slim-configuration-theme-name config)))
  300. (mixed-text-file "slim.cfg" "
  301. default_path /run/current-system/profile/bin
  302. default_xserver " startx "
  303. xserver_arguments :0 vt7
  304. xauth_path " xauth "/bin/xauth
  305. authfile /var/run/slim.auth
  306. # The login command. '%session' is replaced by the chosen session name, one
  307. # of the names specified in the 'sessions' setting: 'wmaker', 'xfce', etc.
  308. login_cmd exec " xinitrc " %session
  309. sessiondir /run/current-system/profile/share/xsessions
  310. session_msg session (F1 to change):
  311. halt_cmd " shepherd "/sbin/halt
  312. reboot_cmd " shepherd "/sbin/reboot\n"
  313. (if (slim-configuration-auto-login? config)
  314. (string-append "auto_login yes\ndefault_user "
  315. (slim-configuration-default-user config) "\n")
  316. "")
  317. (if theme-name
  318. (string-append "current_theme " theme-name "\n")
  319. ""))))
  320. (define theme
  321. (slim-configuration-theme config))
  322. (list (shepherd-service
  323. (documentation "Xorg display server")
  324. (provision '(xorg-server))
  325. (requirement '(user-processes host-name udev))
  326. (start
  327. #~(lambda ()
  328. ;; A stale lock file can prevent SLiM from starting, so remove it to
  329. ;; be on the safe side.
  330. (false-if-exception (delete-file "/var/run/slim.lock"))
  331. (fork+exec-command
  332. (list (string-append #$slim "/bin/slim") "-nodaemon")
  333. #:environment-variables
  334. (list (string-append "SLIM_CFGFILE=" #$slim.cfg)
  335. #$@(if theme
  336. (list #~(string-append "SLIM_THEMESDIR=" #$theme))
  337. #~())))))
  338. (stop #~(make-kill-destructor))
  339. (respawn? #t))))
  340. (define slim-service-type
  341. (service-type (name 'slim)
  342. (extensions
  343. (list (service-extension shepherd-root-service-type
  344. slim-shepherd-service)
  345. (service-extension pam-root-service-type
  346. slim-pam-service)
  347. ;; Unconditionally add xterm to the system profile, to
  348. ;; avoid bad surprises.
  349. (service-extension profile-service-type
  350. (const (list xterm)))))))
  351. (define* (slim-service #:key (slim slim)
  352. (allow-empty-passwords? #t) auto-login?
  353. (default-user "")
  354. (theme %default-slim-theme)
  355. (theme-name %default-slim-theme-name)
  356. (xauth xauth) (shepherd shepherd) (bash bash)
  357. (auto-login-session (file-append windowmaker
  358. "/bin/wmaker"))
  359. (startx (xorg-start-command)))
  360. "Return a service that spawns the SLiM graphical login manager, which in
  361. turn starts the X display server with @var{startx}, a command as returned by
  362. @code{xorg-start-command}.
  363. @cindex X session
  364. SLiM automatically looks for session types described by the @file{.desktop}
  365. files in @file{/run/current-system/profile/share/xsessions} and allows users
  366. to choose a session from the log-in screen using @kbd{F1}. Packages such as
  367. @var{xfce}, @var{sawfish}, and @var{ratpoison} provide @file{.desktop} files;
  368. adding them to the system-wide set of packages automatically makes them
  369. available at the log-in screen.
  370. In addition, @file{~/.xsession} files are honored. When available,
  371. @file{~/.xsession} must be an executable that starts a window manager
  372. and/or other X clients.
  373. When @var{allow-empty-passwords?} is true, allow logins with an empty
  374. password. When @var{auto-login?} is true, log in automatically as
  375. @var{default-user} with @var{auto-login-session}.
  376. If @var{theme} is @code{#f}, the use the default log-in theme; otherwise
  377. @var{theme} must be a gexp denoting the name of a directory containing the
  378. theme to use. In that case, @var{theme-name} specifies the name of the
  379. theme."
  380. (service slim-service-type
  381. (slim-configuration
  382. (slim slim)
  383. (allow-empty-passwords? allow-empty-passwords?)
  384. (auto-login? auto-login?) (default-user default-user)
  385. (theme theme) (theme-name theme-name)
  386. (xauth xauth) (shepherd shepherd) (bash bash)
  387. (auto-login-session auto-login-session)
  388. (startx startx))))
  389. ;;;
  390. ;;; Screen lockers & co.
  391. ;;;
  392. (define-record-type <screen-locker>
  393. (screen-locker name program empty?)
  394. screen-locker?
  395. (name screen-locker-name) ;string
  396. (program screen-locker-program) ;gexp
  397. (empty? screen-locker-allows-empty-passwords?)) ;Boolean
  398. (define screen-locker-pam-services
  399. (match-lambda
  400. (($ <screen-locker> name _ empty?)
  401. (list (unix-pam-service name
  402. #:allow-empty-passwords? empty?)))))
  403. (define screen-locker-setuid-programs
  404. (compose list screen-locker-program))
  405. (define screen-locker-service-type
  406. (service-type (name 'screen-locker)
  407. (extensions
  408. (list (service-extension pam-root-service-type
  409. screen-locker-pam-services)
  410. (service-extension setuid-program-service-type
  411. screen-locker-setuid-programs)))))
  412. (define* (screen-locker-service package
  413. #:optional
  414. (program (package-name package))
  415. #:key allow-empty-passwords?)
  416. "Add @var{package}, a package for a screen-locker or screen-saver whose
  417. command is @var{program}, to the set of setuid programs and add a PAM entry
  418. for it. For example:
  419. @lisp
  420. (screen-locker-service xlockmore \"xlock\")
  421. @end lisp
  422. makes the good ol' XlockMore usable."
  423. (service screen-locker-service-type
  424. (screen-locker program
  425. (file-append package "/bin/" program)
  426. allow-empty-passwords?)))
  427. (define %gdm-accounts
  428. (list (user-group (name "gdm") (system? #t))
  429. (user-account
  430. (name "gdm")
  431. (group "gdm")
  432. (system? #t)
  433. (comment "GNOME Display Manager user")
  434. (home-directory "/var/lib/gdm")
  435. (shell (file-append shadow "/sbin/nologin")))))
  436. (define-record-type* <gdm-configuration>
  437. gdm-configuration make-gdm-configuration
  438. gdm-configuration?
  439. (gdm gdm-configuration-gdm (default gdm))
  440. (allow-empty-passwords? gdm-configuration-allow-empty-passwords? (default #t))
  441. (allow-root? gdm-configuration-allow-root? (default #t))
  442. (auto-login? gdm-configuration-auto-login? (default #f))
  443. (default-user gdm-configuration-default-user (default #f))
  444. (x-server gdm-configuration-x-server))
  445. (define (gdm-etc-service config)
  446. (define gdm-configuration-file
  447. (mixed-text-file "gdm-custom.conf"
  448. "[daemon]\n"
  449. "#User=gdm\n"
  450. "#Group=gdm\n"
  451. (if (gdm-configuration-auto-login? config)
  452. (string-append
  453. "AutomaticLoginEnable=true\n"
  454. "AutomaticLogin="
  455. (or (gdm-configuration-default-user config)
  456. (error "missing default user for auto-login"))
  457. "\n")
  458. (string-append
  459. "AutomaticLoginEnable=false\n"
  460. "#AutomaticLogin=\n"))
  461. "#TimedLoginEnable=false\n"
  462. "#TimedLogin=\n"
  463. "#TimedLoginDelay=0\n"
  464. "#InitialSetupEnable=true\n"
  465. ;; Enable me once X is working.
  466. "WaylandEnable=false\n"
  467. "\n"
  468. "[debug]\n"
  469. "Enable=true\n"
  470. "\n"
  471. "[security]\n"
  472. "#DisallowTCP=true\n"
  473. "#AllowRemoteAutoLogin=false\n"))
  474. `(("gdm" ,(file-union
  475. "gdm"
  476. `(("custom.conf" ,gdm-configuration-file))))))
  477. (define (gdm-pam-service config)
  478. "Return a PAM service for @command{gdm}."
  479. (list
  480. (pam-service
  481. (inherit (unix-pam-service "gdm-autologin"))
  482. (auth (list (pam-entry
  483. (control "[success=ok default=1]")
  484. (module (file-append (gdm-configuration-gdm config)
  485. "/lib/security/pam_gdm.so")))
  486. (pam-entry
  487. (control "sufficient")
  488. (module "pam_permit.so")))))
  489. (pam-service
  490. (inherit (unix-pam-service "gdm-launch-environment"))
  491. (auth (list (pam-entry
  492. (control "required")
  493. (module "pam_permit.so")))))
  494. (unix-pam-service
  495. "gdm-password"
  496. #:allow-empty-passwords? (gdm-configuration-allow-empty-passwords? config)
  497. #:allow-root? (gdm-configuration-allow-root? config))))
  498. (define (gdm-shepherd-service config)
  499. (list (shepherd-service
  500. (documentation "Xorg display server (GDM)")
  501. (provision '(xorg-server))
  502. (requirement '(dbus-system user-processes host-name udev))
  503. ;; While this service isn't working properly, turn off auto-start.
  504. (auto-start? #f)
  505. (start #~(lambda ()
  506. (fork+exec-command
  507. (list #$(file-append (gdm-configuration-gdm config)
  508. "/bin/gdm"))
  509. #:environment-variables
  510. (list (string-append
  511. "GDM_X_SERVER="
  512. #$(gdm-configuration-x-server config))))))
  513. (stop #~(make-kill-destructor))
  514. (respawn? #t))))
  515. (define gdm-service-type
  516. (service-type (name 'gdm)
  517. (extensions
  518. (list (service-extension shepherd-root-service-type
  519. gdm-shepherd-service)
  520. (service-extension account-service-type
  521. (const %gdm-accounts))
  522. (service-extension pam-root-service-type
  523. gdm-pam-service)
  524. (service-extension etc-service-type
  525. gdm-etc-service)
  526. (service-extension dbus-root-service-type
  527. (compose list gdm-configuration-gdm))))))
  528. ;; This service isn't working yet; it gets as far as starting to run the
  529. ;; greeter from gnome-shell but doesn't get any further. It is here because
  530. ;; it doesn't hurt anyone and perhaps it inspires someone to fix it :)
  531. (define* (gdm-service #:key (gdm gdm)
  532. (allow-empty-passwords? #t)
  533. (x-server (xorg-wrapper)))
  534. "Return a service that spawns the GDM graphical login manager, which in turn
  535. starts the X display server with @var{X}, a command as returned by
  536. @code{xorg-wrapper}.
  537. @cindex X session
  538. GDM automatically looks for session types described by the @file{.desktop}
  539. files in @file{/run/current-system/profile/share/xsessions} and allows users
  540. to choose a session from the log-in screen using @kbd{F1}. Packages such as
  541. @var{xfce}, @var{sawfish}, and @var{ratpoison} provide @file{.desktop} files;
  542. adding them to the system-wide set of packages automatically makes them
  543. available at the log-in screen.
  544. In addition, @file{~/.xsession} files are honored. When available,
  545. @file{~/.xsession} must be an executable that starts a window manager
  546. and/or other X clients.
  547. When @var{allow-empty-passwords?} is true, allow logins with an empty
  548. password."
  549. (service gdm-service-type
  550. (gdm-configuration
  551. (gdm gdm)
  552. (allow-empty-passwords? allow-empty-passwords?)
  553. (x-server x-server))))
  554. ;;; xorg.scm ends here