1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2015 Andy Wingo <wingo@igalia.com>
4 ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
5 ;;; Copyright © 2016 Sou Bunnbu <iyzsong@gmail.com>
6 ;;; Copyright © 2017 Maxim Cournoyer <maxim.cournoyer@gmail.com>
7 ;;; Copyright © 2017 ng0 <ng0@infotropique.org>
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 desktop)
25 #:use-module (gnu services)
26 #:use-module (gnu services shepherd)
27 #:use-module (gnu services base)
28 #:use-module (gnu services dbus)
29 #:use-module (gnu services avahi)
30 #:use-module (gnu services xorg)
31 #:use-module (gnu services networking)
32 #:use-module ((gnu system file-systems)
33 #:select (%elogind-file-systems))
34 #:use-module (gnu system shadow)
35 #:use-module (gnu system pam)
36 #:use-module (gnu packages glib)
37 #:use-module (gnu packages admin)
38 #:use-module (gnu packages freedesktop)
39 #:use-module (gnu packages gnome)
40 #:use-module (gnu packages xfce)
41 #:use-module (gnu packages avahi)
42 #:use-module (gnu packages xdisorg)
43 #:use-module (gnu packages suckless)
44 #:use-module (gnu packages linux)
45 #:use-module (gnu packages libusb)
46 #:use-module (gnu packages mate)
47 #:use-module (guix records)
48 #:use-module (guix packages)
49 #:use-module (guix store)
50 #:use-module (guix gexp)
51 #:use-module (srfi srfi-1)
52 #:use-module (ice-9 match)
53 #:export (upower-configuration
67 geoclue-configuration?
68 %standard-geoclue-applications
75 elogind-configuration?
79 accountsservice-service-type
80 accountsservice-service
82 gnome-desktop-configuration
83 gnome-desktop-configuration?
85 gnome-desktop-service-type
87 mate-desktop-configuration
88 mate-desktop-configuration?
90 mate-desktop-service-type
92 xfce-desktop-configuration
93 xfce-desktop-configuration?
95 xfce-desktop-service-type
101 ;;; This module contains service definitions for a "desktop" environment.
111 (if value "true\n" "false\n"))
113 (define (package-direct-input-selector input)
115 (match (assoc-ref (package-direct-inputs package) input)
116 ((package . _) package))))
119 (define (wrapped-dbus-service service program variable value)
120 "Return a wrapper for @var{service}, a package containing a D-Bus service,
121 where @var{program} is wrapped such that environment variable @var{variable}
122 is set to @var{value} when the bus daemon launches it."
124 (program-file (string-append (package-name service) "-program-wrapper")
126 (setenv #$variable #$value)
127 (apply execl (string-append #$service "/" #$program)
128 (string-append #$service "/" #$program)
129 (cdr (command-line))))))
132 (with-imported-modules '((guix build utils))
134 (use-modules (guix build utils))
136 (define service-directory
137 "/share/dbus-1/system-services")
139 (mkdir-p (dirname (string-append #$output
141 (copy-recursively (string-append #$service
143 (string-append #$output
145 (symlink (string-append #$service "/etc") ;for etc/dbus-1
146 (string-append #$output "/etc"))
148 (for-each (lambda (file)
150 (("Exec[[:blank:]]*=[[:blank:]]*([[:graph:]]+)(.*)$"
151 _ original-program arguments)
152 (string-append "Exec=" #$wrapper arguments
154 (find-files #$output "\\.service$")))))
156 (computed-file (string-append (package-name service) "-wrapper")
161 ;;; Upower D-Bus service.
165 (define-record-type* <upower-configuration>
166 upower-configuration make-upower-configuration
167 upower-configuration?
168 (upower upower-configuration-upower
170 (watts-up-pro? upower-configuration-watts-up-pro?)
171 (poll-batteries? upower-configuration-poll-batteries?)
172 (ignore-lid? upower-configuration-ignore-lid?)
173 (use-percentage-for-policy? upower-configuration-use-percentage-for-policy?)
174 (percentage-low upower-configuration-percentage-low)
175 (percentage-critical upower-configuration-percentage-critical)
176 (percentage-action upower-configuration-percentage-action)
177 (time-low upower-configuration-time-low)
178 (time-critical upower-configuration-time-critical)
179 (time-action upower-configuration-time-action)
180 (critical-power-action upower-configuration-critical-power-action))
182 (define* upower-configuration-file
183 ;; Return an upower-daemon configuration file.
185 (($ <upower-configuration> upower
186 watts-up-pro? poll-batteries? ignore-lid? use-percentage-for-policy?
187 percentage-low percentage-critical percentage-action time-low
188 time-critical time-action critical-power-action)
189 (plain-file "UPower.conf"
192 "EnableWattsUpPro=" (bool watts-up-pro?)
193 "NoPollBatteries=" (bool (not poll-batteries?))
194 "IgnoreLid=" (bool ignore-lid?)
195 "UsePercentageForPolicy=" (bool use-percentage-for-policy?)
196 "PercentageLow=" (number->string percentage-low) "\n"
197 "PercentageCritical=" (number->string percentage-critical) "\n"
198 "PercentageAction=" (number->string percentage-action) "\n"
199 "TimeLow=" (number->string time-low) "\n"
200 "TimeCritical=" (number->string time-critical) "\n"
201 "TimeAction=" (number->string time-action) "\n"
202 "CriticalPowerAction=" (match critical-power-action
203 ('hybrid-sleep "HybridSleep")
204 ('hibernate "Hibernate")
205 ('power-off "PowerOff"))
208 (define %upower-activation
210 (use-modules (guix build utils))
211 (mkdir-p "/var/lib/upower")))
213 (define (upower-dbus-service config)
214 (list (wrapped-dbus-service (upower-configuration-upower config)
216 "UPOWER_CONF_FILE_NAME"
217 (upower-configuration-file config))))
219 (define (upower-shepherd-service config)
220 "Return a shepherd service for UPower with CONFIG."
221 (let ((upower (upower-configuration-upower config))
222 (config (upower-configuration-file config)))
223 (list (shepherd-service
224 (documentation "Run the UPower power and battery monitor.")
225 (provision '(upower-daemon))
226 (requirement '(dbus-system udev))
228 (start #~(make-forkexec-constructor
229 (list (string-append #$upower "/libexec/upowerd"))
230 #:environment-variables
231 (list (string-append "UPOWER_CONF_FILE_NAME="
233 (stop #~(make-kill-destructor))))))
235 (define upower-service-type
236 (let ((upower-package (compose list upower-configuration-upower)))
237 (service-type (name 'upower)
239 (list (service-extension dbus-root-service-type
241 (service-extension shepherd-root-service-type
242 upower-shepherd-service)
243 (service-extension activation-service-type
244 (const %upower-activation))
245 (service-extension udev-service-type
248 ;; Make the 'upower' command visible.
249 (service-extension profile-service-type
252 (define* (upower-service #:key (upower upower)
256 (use-percentage-for-policy? #f)
258 (percentage-critical 3)
259 (percentage-action 2)
263 (critical-power-action 'hybrid-sleep))
264 "Return a service that runs @uref{http://upower.freedesktop.org/,
265 @command{upowerd}}, a system-wide monitor for power consumption and battery
266 levels, with the given configuration settings. It implements the
267 @code{org.freedesktop.UPower} D-Bus interface, and is notably used by GNOME."
268 (let ((config (upower-configuration
269 (watts-up-pro? watts-up-pro?)
270 (poll-batteries? poll-batteries?)
271 (ignore-lid? ignore-lid?)
272 (use-percentage-for-policy? use-percentage-for-policy?)
273 (percentage-low percentage-low)
274 (percentage-critical percentage-critical)
275 (percentage-action percentage-action)
277 (time-critical time-critical)
278 (time-action time-action)
279 (critical-power-action critical-power-action))))
280 (service upower-service-type config)))
284 ;;; GeoClue D-Bus service.
288 (define-record-type* <geoclue-configuration>
289 geoclue-configuration make-geoclue-configuration
290 geoclue-configuration?
291 (geoclue geoclue-configuration-geoclue
293 (whitelist geoclue-configuration-whitelist)
294 (wifi-geolocation-url geoclue-configuration-wifi-geolocation-url)
295 (submit-data? geoclue-configuration-submit-data?)
296 (wifi-submission-url geoclue-configuration-wifi-submission-url)
297 (submission-nick geoclue-configuration-submission-nick)
298 (applications geoclue-configuration-applications))
300 (define* (geoclue-application name #:key (allowed? #t) system? (users '()))
301 "Configure default GeoClue access permissions for an application. NAME is
302 the Desktop ID of the application, without the .desktop part. If ALLOWED? is
303 true, the application will have access to location information by default.
304 The boolean SYSTEM? value indicates that an application is a system component
305 or not. Finally USERS is a list of UIDs of all users for which this
306 application is allowed location info access. An empty users list means all
310 "allowed=" (bool allowed?)
311 "system=" (bool system?)
312 "users=" (string-join users ";") "\n"))
314 (define %standard-geoclue-applications
315 (list (geoclue-application "gnome-datetime-panel" #:system? #t)
316 (geoclue-application "epiphany" #:system? #f)
317 (geoclue-application "firefox" #:system? #f)))
319 (define* (geoclue-configuration-file config)
320 "Return a geoclue configuration file."
321 (plain-file "geoclue.conf"
325 (string-join (geoclue-configuration-whitelist config)
328 "url=" (geoclue-configuration-wifi-geolocation-url config) "\n"
329 "submit-data=" (bool (geoclue-configuration-submit-data? config))
331 (geoclue-configuration-wifi-submission-url config) "\n"
333 (geoclue-configuration-submission-nick config)
335 (string-join (geoclue-configuration-applications config)
338 (define (geoclue-dbus-service config)
339 (list (wrapped-dbus-service (geoclue-configuration-geoclue config)
341 "GEOCLUE_CONFIG_FILE"
342 (geoclue-configuration-file config))))
344 (define %geoclue-accounts
345 (list (user-group (name "geoclue") (system? #t))
350 (comment "GeoClue daemon user")
351 (home-directory "/var/empty")
352 (shell "/run/current-system/profile/sbin/nologin"))))
354 (define geoclue-service-type
355 (service-type (name 'geoclue)
357 (list (service-extension dbus-root-service-type
358 geoclue-dbus-service)
359 (service-extension account-service-type
360 (const %geoclue-accounts))))))
362 (define* (geoclue-service #:key (geoclue geoclue)
364 (wifi-geolocation-url
365 ;; Mozilla geolocation service:
366 "https://location.services.mozilla.com/v1/geolocate?key=geoclue")
369 "https://location.services.mozilla.com/v1/submit?key=geoclue")
370 (submission-nick "geoclue")
371 (applications %standard-geoclue-applications))
372 "Return a service that runs the @command{geoclue} location service. This
373 service provides a D-Bus interface to allow applications to request access to
374 a user's physical location, and optionally to add information to online
375 location databases. By default, only the GNOME date-time panel and the Icecat
376 and Epiphany web browsers are able to ask for the user's location, and in the
377 case of Icecat and Epiphany, both will ask the user for permission first. See
378 @uref{https://wiki.freedesktop.org/www/Software/GeoClue/, the geoclue web
379 site} for more information."
380 (service geoclue-service-type
381 (geoclue-configuration
383 (whitelist whitelist)
384 (wifi-geolocation-url wifi-geolocation-url)
385 (submit-data? submit-data?)
386 (wifi-submission-url wifi-submission-url)
387 (submission-nick submission-nick)
388 (applications applications))))
395 (define-record-type* <bluetooth-configuration>
396 bluetooth-configuration make-bluetooth-configuration
397 bluetooth-configuration?
398 (bluez bluetooth-configuration-bluez (default bluez))
399 (auto-enable? bluetooth-configuration-auto-enable? (default #f)))
401 (define (bluetooth-configuration-file config)
402 "Return a configuration file for the systemd bluetooth service, as a string."
405 "AutoEnable=" (bool (bluetooth-configuration-auto-enable?
408 (define (bluetooth-directory config)
409 (computed-file "etc-bluetooth"
413 (call-with-output-file "main.conf"
415 (display #$(bluetooth-configuration-file config)
418 (define (bluetooth-shepherd-service config)
419 "Return a shepherd service for @command{bluetoothd}."
421 (provision '(bluetooth))
422 (requirement '(dbus-system udev))
423 (documentation "Run the bluetoothd daemon.")
424 (start #~(make-forkexec-constructor
425 (string-append #$(bluetooth-configuration-bluez config)
426 "/libexec/bluetooth/bluetoothd")))
427 (stop #~(make-kill-destructor))))
429 (define bluetooth-service-type
433 (list (service-extension dbus-root-service-type
434 (compose list bluetooth-configuration-bluez))
435 (service-extension udev-service-type
436 (compose list bluetooth-configuration-bluez))
437 (service-extension etc-service-type
440 ,(bluetooth-directory config)))))
441 (service-extension shepherd-root-service-type
442 (compose list bluetooth-shepherd-service))))))
444 (define* (bluetooth-service #:key (bluez bluez) (auto-enable? #f))
445 "Return a service that runs the @command{bluetoothd} daemon, which manages
446 all the Bluetooth devices and provides a number of D-Bus interfaces. When
447 AUTO-ENABLE? is true, the bluetooth controller is powered automatically at
450 Users need to be in the @code{lp} group to access the D-Bus service.
452 (service bluetooth-service-type
453 (bluetooth-configuration
455 (auto-enable? auto-enable?))))
459 ;;; Colord D-Bus service.
462 (define %colord-activation
464 (use-modules (guix build utils))
465 (mkdir-p "/var/lib/colord")
466 (let ((user (getpwnam "colord")))
467 (chown "/var/lib/colord"
468 (passwd:uid user) (passwd:gid user)))))
470 (define %colord-accounts
471 (list (user-group (name "colord") (system? #t))
476 (comment "colord daemon user")
477 (home-directory "/var/empty")
478 (shell (file-append shadow "/sbin/nologin")))))
480 (define colord-service-type
481 (service-type (name 'colord)
483 (list (service-extension account-service-type
484 (const %colord-accounts))
485 (service-extension activation-service-type
486 (const %colord-activation))
488 ;; Colord is a D-Bus service that dbus-daemon can
490 (service-extension dbus-root-service-type list)
492 ;; Colord provides "color device" rules for udev.
493 (service-extension udev-service-type list)
495 ;; It provides polkit "actions".
496 (service-extension polkit-service-type list)))))
498 (define* (colord-service #:key (colord colord))
499 "Return a service that runs @command{colord}, a system service with a D-Bus
500 interface to manage the color profiles of input and output devices such as
501 screens and scanners. It is notably used by the GNOME Color Manager graphical
502 tool. See @uref{http://www.freedesktop.org/software/colord/, the colord web
503 site} for more information."
504 (service colord-service-type colord))
511 (define-record-type* <udisks-configuration>
512 udisks-configuration make-udisks-configuration
513 udisks-configuration?
514 (udisks udisks-configuration-udisks
517 (define %udisks-activation
518 (with-imported-modules '((guix build utils))
520 (use-modules (guix build utils))
522 (let ((run-dir "/var/run/udisks2"))
524 (chmod run-dir #o700)))))
526 (define udisks-service-type
527 (let ((udisks-package (lambda (config)
528 (list (udisks-configuration-udisks config)))))
529 (service-type (name 'udisks)
531 (list (service-extension polkit-service-type
533 (service-extension dbus-root-service-type
535 (service-extension udev-service-type
537 (service-extension activation-service-type
538 (const %udisks-activation))
540 ;; Profile 'udisksctl' & co. in the system profile.
541 (service-extension profile-service-type
544 (define* (udisks-service #:key (udisks udisks))
545 "Return a service for @uref{http://udisks.freedesktop.org/docs/latest/,
546 UDisks}, a @dfn{disk management} daemon that provides user interfaces with
547 notifications and ways to mount/unmount disks. Programs that talk to UDisks
548 include the @command{udisksctl} command, part of UDisks, and GNOME Disks."
549 (service udisks-service-type
550 (udisks-configuration (udisks udisks))))
554 ;;; Elogind login and seat management service.
557 (define-record-type* <elogind-configuration> elogind-configuration
558 make-elogind-configuration
559 elogind-configuration
560 (elogind elogind-package
562 (kill-user-processes? elogind-kill-user-processes?
564 (kill-only-users elogind-kill-only-users
566 (kill-exclude-users elogind-kill-exclude-users
568 (inhibit-delay-max-seconds elogind-inhibit-delay-max-seconds
570 (handle-power-key elogind-handle-power-key
572 (handle-suspend-key elogind-handle-suspend-key
574 (handle-hibernate-key elogind-handle-hibernate-key
575 ;; (default 'hibernate)
576 ;; XXX Ignore it for now, since we don't
577 ;; yet handle resume-from-hibernation in
580 (handle-lid-switch elogind-handle-lid-switch
582 (handle-lid-switch-docked elogind-handle-lid-switch-docked
584 (power-key-ignore-inhibited? elogind-power-key-ignore-inhibited?
586 (suspend-key-ignore-inhibited? elogind-suspend-key-ignore-inhibited?
588 (hibernate-key-ignore-inhibited? elogind-hibernate-key-ignore-inhibited?
590 (lid-switch-ignore-inhibited? elogind-lid-switch-ignore-inhibited?
592 (holdoff-timeout-seconds elogind-holdoff-timeout-seconds
594 (idle-action elogind-idle-action
596 (idle-action-seconds elogind-idle-action-seconds
598 (runtime-directory-size-percent elogind-runtime-directory-size-percent
600 (runtime-directory-size elogind-runtime-directory-size
602 (remove-ipc? elogind-remove-ipc?
605 (suspend-state elogind-suspend-state
606 (default '("mem" "standby" "freeze")))
607 (suspend-mode elogind-suspend-mode
609 (hibernate-state elogind-hibernate-state
611 (hibernate-mode elogind-hibernate-mode
612 (default '("platform" "shutdown")))
613 (hybrid-sleep-state elogind-hybrid-sleep-state
615 (hybrid-sleep-mode elogind-hybrid-sleep-mode
617 '("suspend" "platform" "shutdown"))))
619 (define (elogind-configuration-file config)
624 (_ (error "expected #t or #f, instead got:" x))))
625 (define char-set:user-name
626 (string->char-set "abcdefghijklmnopqrstuvwxyz0123456789_-"))
627 (define (valid-list? l pred)
628 (and-map (lambda (x) (string-every pred x)) l))
629 (define (user-name-list users)
630 (unless (valid-list? users char-set:user-name)
631 (error "invalid user list" users))
632 (string-join users " "))
633 (define (enum val allowed)
634 (unless (memq val allowed)
635 (error "invalid value" val allowed))
636 (symbol->string val))
637 (define (non-negative-integer x)
638 (unless (exact-integer? x) (error "not an integer" x))
639 (when (negative? x) (error "negative number not allowed" x))
641 (define handle-actions
642 '(ignore poweroff reboot halt kexec suspend hibernate hybrid-sleep lock))
643 (define (handle-action x)
644 (enum x handle-actions))
645 (define (sleep-list tokens)
646 (unless (valid-list? tokens char-set:user-name)
647 (error "invalid sleep list" tokens))
648 (string-join tokens " "))
649 (define-syntax ini-file-clause
651 ((_ config (prop (parser getter)))
652 (string-append prop "=" (parser (getter config)) "\n"))
654 (string-append str "\n"))))
655 (define-syntax-rule (ini-file config file clause ...)
656 (plain-file file (string-append (ini-file-clause config clause) ...)))
660 ("KillUserProcesses" (yesno elogind-kill-user-processes?))
661 ("KillOnlyUsers" (user-name-list elogind-kill-only-users))
662 ("KillExcludeUsers" (user-name-list elogind-kill-exclude-users))
663 ("InhibitDelayMaxSecs" (non-negative-integer elogind-inhibit-delay-max-seconds))
664 ("HandlePowerKey" (handle-action elogind-handle-power-key))
665 ("HandleSuspendKey" (handle-action elogind-handle-suspend-key))
666 ("HandleHibernateKey" (handle-action elogind-handle-hibernate-key))
667 ("HandleLidSwitch" (handle-action elogind-handle-lid-switch))
668 ("HandleLidSwitchDocked" (handle-action elogind-handle-lid-switch-docked))
669 ("PowerKeyIgnoreInhibited" (yesno elogind-power-key-ignore-inhibited?))
670 ("SuspendKeyIgnoreInhibited" (yesno elogind-suspend-key-ignore-inhibited?))
671 ("HibernateKeyIgnoreInhibited" (yesno elogind-hibernate-key-ignore-inhibited?))
672 ("LidSwitchIgnoreInhibited" (yesno elogind-lid-switch-ignore-inhibited?))
673 ("HoldoffTimeoutSecs" (non-negative-integer elogind-holdoff-timeout-seconds))
674 ("IdleAction" (handle-action elogind-idle-action))
675 ("IdleActionSeconds" (non-negative-integer elogind-idle-action-seconds))
676 ("RuntimeDirectorySize"
679 (match (elogind-runtime-directory-size-percent config)
680 (#f (non-negative-integer (elogind-runtime-directory-size config)))
681 (percent (string-append (non-negative-integer percent) "%"))))))
682 ("RemoveIpc" (yesno elogind-remove-ipc?))
684 ("SuspendState" (sleep-list elogind-suspend-state))
685 ("SuspendMode" (sleep-list elogind-suspend-mode))
686 ("HibernateState" (sleep-list elogind-hibernate-state))
687 ("HibernateMode" (sleep-list elogind-hibernate-mode))
688 ("HybridSleepState" (sleep-list elogind-hybrid-sleep-state))
689 ("HybridSleepMode" (sleep-list elogind-hybrid-sleep-mode))))
691 (define (elogind-dbus-service config)
692 (list (wrapped-dbus-service (elogind-package config)
693 "libexec/elogind/elogind"
695 (elogind-configuration-file config))))
697 (define (pam-extension-procedure config)
698 "Return an extension for PAM-ROOT-SERVICE-TYPE that ensures that all the PAM
699 services use 'pam_elogind.so', a module that allows elogind to keep track of
700 logged-in users (run 'loginctl' to see elogind's world view of users and
705 (module (file-append (elogind-package config)
706 "/lib/security/pam_elogind.so"))))
711 (session (cons pam-elogind (pam-service-session pam)))))))
713 (define (elogind-shepherd-service config)
714 "Return a Shepherd service to start elogind according to @var{config}."
715 (list (shepherd-service
716 (requirement '(dbus-system))
717 (provision '(elogind))
718 (start #~(make-forkexec-constructor
719 (list #$(file-append (elogind-package config)
720 "/libexec/elogind/elogind"))
721 #:environment-variables
722 (list (string-append "ELOGIND_CONF_FILE="
723 #$(elogind-configuration-file
725 (stop #~(make-kill-destructor)))))
727 (define elogind-service-type
728 (service-type (name 'elogind)
730 (list (service-extension dbus-root-service-type
731 elogind-dbus-service)
732 (service-extension udev-service-type
733 (compose list elogind-package))
734 (service-extension polkit-service-type
735 (compose list elogind-package))
737 ;; Start elogind from the Shepherd rather than waiting
738 ;; for bus activation. This ensures that it can handle
739 ;; events like lid close, etc.
740 (service-extension shepherd-root-service-type
741 elogind-shepherd-service)
743 ;; Provide the 'loginctl' command.
744 (service-extension profile-service-type
745 (compose list elogind-package))
747 ;; Extend PAM with pam_elogind.so.
748 (service-extension pam-root-service-type
749 pam-extension-procedure)
751 ;; We need /run/user, /run/systemd, etc.
752 (service-extension file-system-service-type
753 (const %elogind-file-systems))))
754 (default-value (elogind-configuration))))
756 (define* (elogind-service #:key (config (elogind-configuration)))
757 "Return a service that runs the @command{elogind} login and seat management
758 service. The @command{elogind} service integrates with PAM to allow other
759 system components to know the set of logged-in users as well as their session
760 types (graphical, console, remote, etc.). It can also clean up after users
762 (service elogind-service-type config))
766 ;;; AccountsService service.
769 (define %accountsservice-activation
771 (use-modules (guix build utils))
772 (mkdir-p "/var/lib/AccountsService")))
774 (define accountsservice-service-type
775 (service-type (name 'accountsservice)
777 (list (service-extension activation-service-type
778 (const %accountsservice-activation))
779 (service-extension dbus-root-service-type list)
780 (service-extension polkit-service-type list)))))
782 (define* (accountsservice-service #:key (accountsservice accountsservice))
783 "Return a service that runs AccountsService, a system service that
784 can list available accounts, change their passwords, and so on.
785 AccountsService integrates with PolicyKit to enable unprivileged users to
786 acquire the capability to modify their system configuration.
787 @uref{https://www.freedesktop.org/wiki/Software/AccountsService/, the
788 accountsservice web site} for more information."
789 (service accountsservice-service-type accountsservice))
793 ;;; GNOME desktop service.
796 (define-record-type* <gnome-desktop-configuration> gnome-desktop-configuration
797 make-gnome-desktop-configuration
798 gnome-desktop-configuration
799 (gnome-package gnome-package (default gnome)))
801 (define (gnome-polkit-settings config)
802 "Return the list of GNOME dependencies that provide polkit actions and
804 (let ((gnome (gnome-package config)))
806 ((package-direct-input-selector name) gnome))
807 '("gnome-settings-daemon"
808 "gnome-control-center"
809 "gnome-system-monitor"
812 (define gnome-desktop-service-type
814 (name 'gnome-desktop)
816 (list (service-extension polkit-service-type
817 gnome-polkit-settings)
818 (service-extension profile-service-type
822 (define* (gnome-desktop-service #:key (config (gnome-desktop-configuration)))
823 "Return a service that adds the @code{gnome} package to the system profile,
824 and extends polkit with the actions from @code{gnome-settings-daemon}."
825 (service gnome-desktop-service-type config))
827 ;; MATE Desktop service.
828 ;; TODO: Add mate-screensaver.
830 (define-record-type* <mate-desktop-configuration> mate-desktop-configuration
831 make-mate-desktop-configuration
832 mate-desktop-configuration
833 (mate-package mate-package (default mate)))
835 (define mate-desktop-service-type
839 (list (service-extension polkit-service-type
841 (package-direct-input-selector
842 "mate-settings-daemon")
844 (service-extension profile-service-type
848 (define* (mate-desktop-service #:key (config (mate-desktop-configuration)))
849 "Return a service that adds the @code{mate} package to the system profile,
850 and extends polkit with the actions from @code{mate-settings-daemon}."
851 (service mate-desktop-service-type config))
855 ;;; XFCE desktop service.
858 (define-record-type* <xfce-desktop-configuration> xfce-desktop-configuration
859 make-xfce-desktop-configuration
860 xfce-desktop-configuration
861 (xfce xfce-package (default xfce)))
863 (define xfce-desktop-service-type
867 (list (service-extension polkit-service-type
869 (package-direct-input-selector
872 (service-extension profile-service-type
876 (define* (xfce-desktop-service #:key (config (xfce-desktop-configuration)))
877 "Return a service that adds the @code{xfce} package to the system profile,
878 and extends polkit with the ability for @code{thunar} to manipulate the file
879 system as root from within a user session, after the user has authenticated
880 with the administrator's password."
881 (service xfce-desktop-service-type config))
885 ;;; The default set of desktop services.
888 (define %desktop-services
889 ;; List of services typically useful for a "desktop" use case.
890 (cons* (service slim-service-type)
892 ;; Screen lockers are a pretty useful thing and these are small.
893 (screen-locker-service slock)
894 (screen-locker-service xlockmore "xlock")
896 ;; Add udev rules for MTP devices so that non-root users can access
898 (simple-service 'mtp udev-service-type (list libmtp))
901 (service network-manager-service-type)
902 (service wpa-supplicant-service-type) ;needed by NetworkManager
906 (accountsservice-service)
917 ;;; desktop.scm ends here