desktop.scm 50 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020 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, 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
  7. ;;; Copyright © 2017 Nikita <nikita@n0.is>
  8. ;;; Copyright © 2018, 2020 Efraim Flashner <efraim@flashner.co.il>
  9. ;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
  10. ;;; Copyright © 2017, 2019 Christopher Baines <mail@cbaines.net>
  11. ;;; Copyright © 2019 Tim Gesthuizen <tim.gesthuizen@yahoo.de>
  12. ;;; Copyright © 2019 David Wilson <david@daviwil.com>
  13. ;;; Copyright © 2020 Tobias Geerinckx-Rice <me@tobias.gr>
  14. ;;;
  15. ;;; This file is part of GNU Guix.
  16. ;;;
  17. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  18. ;;; under the terms of the GNU General Public License as published by
  19. ;;; the Free Software Foundation; either version 3 of the License, or (at
  20. ;;; your option) any later version.
  21. ;;;
  22. ;;; GNU Guix is distributed in the hope that it will be useful, but
  23. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  24. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  25. ;;; GNU General Public License for more details.
  26. ;;;
  27. ;;; You should have received a copy of the GNU General Public License
  28. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  29. (define-module (gnu services desktop)
  30. #:use-module (gnu services)
  31. #:use-module (gnu services shepherd)
  32. #:use-module (gnu services base)
  33. #:use-module (gnu services dbus)
  34. #:use-module (gnu services avahi)
  35. #:use-module (gnu services xorg)
  36. #:use-module (gnu services networking)
  37. #:use-module (gnu services sound)
  38. #:use-module ((gnu system file-systems)
  39. #:select (%elogind-file-systems file-system))
  40. #:use-module (gnu system)
  41. #:use-module (gnu system shadow)
  42. #:use-module (gnu system pam)
  43. #:use-module (gnu packages glib)
  44. #:use-module (gnu packages admin)
  45. #:use-module (gnu packages cups)
  46. #:use-module (gnu packages freedesktop)
  47. #:use-module (gnu packages gnome)
  48. #:use-module (gnu packages xfce)
  49. #:use-module (gnu packages avahi)
  50. #:use-module (gnu packages xdisorg)
  51. #:use-module (gnu packages scanner)
  52. #:use-module (gnu packages suckless)
  53. #:use-module (gnu packages linux)
  54. #:use-module (gnu packages libusb)
  55. #:use-module (gnu packages mate)
  56. #:use-module (gnu packages nfs)
  57. #:use-module (gnu packages enlightenment)
  58. #:use-module (guix deprecation)
  59. #:use-module (guix records)
  60. #:use-module (guix packages)
  61. #:use-module (guix store)
  62. #:use-module (guix utils)
  63. #:use-module (guix gexp)
  64. #:use-module (srfi srfi-1)
  65. #:use-module (ice-9 match)
  66. #:export (<upower-configuration>
  67. upower-configuration
  68. upower-configuration?
  69. upower-configuration-upower
  70. upower-configuration-watts-up-pro?
  71. upower-configuration-poll-batteries?
  72. upower-configuration-ignore-lid?
  73. upower-configuration-use-percentage-for-policy?
  74. upower-configuration-percentage-low
  75. upower-configuration-percentage-critical
  76. upower-configuration-percentage-action
  77. upower-configuration-time-low
  78. upower-configuration-time-critical
  79. upower-configuration-time-action
  80. upower-configuration-critical-power-action
  81. upower-service
  82. upower-service-type
  83. udisks-configuration
  84. udisks-configuration?
  85. udisks-service
  86. udisks-service-type
  87. colord-service-type
  88. colord-service
  89. geoclue-application
  90. geoclue-configuration
  91. geoclue-configuration?
  92. %standard-geoclue-applications
  93. geoclue-service
  94. geoclue-service-type
  95. bluetooth-service-type
  96. bluetooth-configuration
  97. bluetooth-configuration?
  98. bluetooth-service
  99. elogind-configuration
  100. elogind-configuration?
  101. elogind-service
  102. elogind-service-type
  103. %fontconfig-file-system
  104. fontconfig-file-system-service
  105. accountsservice-service-type
  106. accountsservice-service
  107. cups-pk-helper-service-type
  108. sane-service-type
  109. gnome-desktop-configuration
  110. gnome-desktop-configuration?
  111. gnome-desktop-service
  112. gnome-desktop-service-type
  113. mate-desktop-configuration
  114. mate-desktop-configuration?
  115. mate-desktop-service
  116. mate-desktop-service-type
  117. xfce-desktop-configuration
  118. xfce-desktop-configuration?
  119. xfce-desktop-service
  120. xfce-desktop-service-type
  121. x11-socket-directory-service
  122. enlightenment-desktop-configuration
  123. enlightenment-desktop-configuration?
  124. enlightenment-desktop-service-type
  125. inputattach-configuration
  126. inputattach-configuration?
  127. inputattach-service-type
  128. polkit-wheel-service
  129. gnome-keyring-configuration
  130. gnome-keyring-configuration?
  131. gnome-keyring-service-type
  132. %desktop-services))
  133. ;;; Commentary:
  134. ;;;
  135. ;;; This module contains service definitions for a "desktop" environment.
  136. ;;;
  137. ;;; Code:
  138. ;;;
  139. ;;; Helpers.
  140. ;;;
  141. (define (bool value)
  142. (if value "true\n" "false\n"))
  143. (define (package-direct-input-selector input)
  144. (lambda (package)
  145. (match (assoc-ref (package-direct-inputs package) input)
  146. ((package . _) package))))
  147. ;;;
  148. ;;; Upower D-Bus service.
  149. ;;;
  150. (define-record-type* <upower-configuration>
  151. upower-configuration make-upower-configuration
  152. upower-configuration?
  153. (upower upower-configuration-upower
  154. (default upower))
  155. (watts-up-pro? upower-configuration-watts-up-pro?
  156. (default #f))
  157. (poll-batteries? upower-configuration-poll-batteries?
  158. (default #t))
  159. (ignore-lid? upower-configuration-ignore-lid?
  160. (default #f))
  161. (use-percentage-for-policy? upower-configuration-use-percentage-for-policy?
  162. (default #f))
  163. (percentage-low upower-configuration-percentage-low
  164. (default 10))
  165. (percentage-critical upower-configuration-percentage-critical
  166. (default 3))
  167. (percentage-action upower-configuration-percentage-action
  168. (default 2))
  169. (time-low upower-configuration-time-low
  170. (default 1200))
  171. (time-critical upower-configuration-time-critical
  172. (default 300))
  173. (time-action upower-configuration-time-action
  174. (default 120))
  175. (critical-power-action upower-configuration-critical-power-action
  176. (default 'hybrid-sleep)))
  177. (define* upower-configuration-file
  178. ;; Return an upower-daemon configuration file.
  179. (match-lambda
  180. (($ <upower-configuration> upower
  181. watts-up-pro? poll-batteries? ignore-lid? use-percentage-for-policy?
  182. percentage-low percentage-critical percentage-action time-low
  183. time-critical time-action critical-power-action)
  184. (plain-file "UPower.conf"
  185. (string-append
  186. "[UPower]\n"
  187. "EnableWattsUpPro=" (bool watts-up-pro?)
  188. "NoPollBatteries=" (bool (not poll-batteries?))
  189. "IgnoreLid=" (bool ignore-lid?)
  190. "UsePercentageForPolicy=" (bool use-percentage-for-policy?)
  191. "PercentageLow=" (number->string percentage-low) "\n"
  192. "PercentageCritical=" (number->string percentage-critical) "\n"
  193. "PercentageAction=" (number->string percentage-action) "\n"
  194. "TimeLow=" (number->string time-low) "\n"
  195. "TimeCritical=" (number->string time-critical) "\n"
  196. "TimeAction=" (number->string time-action) "\n"
  197. "CriticalPowerAction=" (match critical-power-action
  198. ('hybrid-sleep "HybridSleep")
  199. ('hibernate "Hibernate")
  200. ('power-off "PowerOff"))
  201. "\n")))))
  202. (define %upower-activation
  203. #~(begin
  204. (use-modules (guix build utils))
  205. (mkdir-p "/var/lib/upower")))
  206. (define (upower-dbus-service config)
  207. (list (wrapped-dbus-service (upower-configuration-upower config)
  208. "libexec/upowerd"
  209. `(("UPOWER_CONF_FILE_NAME"
  210. ,(upower-configuration-file config))))))
  211. (define (upower-shepherd-service config)
  212. "Return a shepherd service for UPower with CONFIG."
  213. (let ((upower (upower-configuration-upower config))
  214. (config (upower-configuration-file config)))
  215. (list (shepherd-service
  216. (documentation "Run the UPower power and battery monitor.")
  217. (provision '(upower-daemon))
  218. (requirement '(dbus-system udev))
  219. (start #~(make-forkexec-constructor
  220. (list (string-append #$upower "/libexec/upowerd"))
  221. #:environment-variables
  222. (list (string-append "UPOWER_CONF_FILE_NAME="
  223. #$config))))
  224. (stop #~(make-kill-destructor))))))
  225. (define upower-service-type
  226. (let ((upower-package (compose list upower-configuration-upower)))
  227. (service-type (name 'upower)
  228. (description
  229. "Run @command{upowerd}}, a system-wide monitor for power
  230. consumption and battery levels, with the given configuration settings. It
  231. implements the @code{org.freedesktop.UPower} D-Bus interface, and is notably
  232. used by GNOME.")
  233. (extensions
  234. (list (service-extension dbus-root-service-type
  235. upower-dbus-service)
  236. (service-extension shepherd-root-service-type
  237. upower-shepherd-service)
  238. (service-extension activation-service-type
  239. (const %upower-activation))
  240. (service-extension udev-service-type
  241. upower-package)
  242. ;; Make the 'upower' command visible.
  243. (service-extension profile-service-type
  244. upower-package)))
  245. (default-value (upower-configuration)))))
  246. (define-deprecated (upower-service #:key (upower upower)
  247. (watts-up-pro? #f)
  248. (poll-batteries? #t)
  249. (ignore-lid? #f)
  250. (use-percentage-for-policy? #f)
  251. (percentage-low 10)
  252. (percentage-critical 3)
  253. (percentage-action 2)
  254. (time-low 1200)
  255. (time-critical 300)
  256. (time-action 120)
  257. (critical-power-action 'hybrid-sleep))
  258. upower-service-type
  259. "Return a service that runs @uref{http://upower.freedesktop.org/,
  260. @command{upowerd}}, a system-wide monitor for power consumption and battery
  261. levels, with the given configuration settings. It implements the
  262. @code{org.freedesktop.UPower} D-Bus interface, and is notably used by GNOME."
  263. (let ((config (upower-configuration
  264. (watts-up-pro? watts-up-pro?)
  265. (poll-batteries? poll-batteries?)
  266. (ignore-lid? ignore-lid?)
  267. (use-percentage-for-policy? use-percentage-for-policy?)
  268. (percentage-low percentage-low)
  269. (percentage-critical percentage-critical)
  270. (percentage-action percentage-action)
  271. (time-low time-low)
  272. (time-critical time-critical)
  273. (time-action time-action)
  274. (critical-power-action critical-power-action))))
  275. (service upower-service-type config)))
  276. ;;;
  277. ;;; GeoClue D-Bus service.
  278. ;;;
  279. ;; TODO: Export.
  280. (define-record-type* <geoclue-configuration>
  281. geoclue-configuration make-geoclue-configuration
  282. geoclue-configuration?
  283. (geoclue geoclue-configuration-geoclue
  284. (default geoclue))
  285. (whitelist geoclue-configuration-whitelist)
  286. (wifi-geolocation-url geoclue-configuration-wifi-geolocation-url)
  287. (submit-data? geoclue-configuration-submit-data?)
  288. (wifi-submission-url geoclue-configuration-wifi-submission-url)
  289. (submission-nick geoclue-configuration-submission-nick)
  290. (applications geoclue-configuration-applications))
  291. (define* (geoclue-application name #:key (allowed? #t) system? (users '()))
  292. "Configure default GeoClue access permissions for an application. NAME is
  293. the Desktop ID of the application, without the .desktop part. If ALLOWED? is
  294. true, the application will have access to location information by default.
  295. The boolean SYSTEM? value indicates that an application is a system component
  296. or not. Finally USERS is a list of UIDs of all users for which this
  297. application is allowed location info access. An empty users list means all
  298. users are allowed."
  299. (string-append
  300. "[" name "]\n"
  301. "allowed=" (bool allowed?)
  302. "system=" (bool system?)
  303. "users=" (string-join users ";") "\n"))
  304. (define %standard-geoclue-applications
  305. (list (geoclue-application "gnome-datetime-panel" #:system? #t)
  306. (geoclue-application "epiphany" #:system? #f)
  307. (geoclue-application "firefox" #:system? #f)))
  308. (define* (geoclue-configuration-file config)
  309. "Return a geoclue configuration file."
  310. (plain-file "geoclue.conf"
  311. (string-append
  312. "[agent]\n"
  313. "whitelist="
  314. (string-join (geoclue-configuration-whitelist config)
  315. ";") "\n"
  316. "[wifi]\n"
  317. "url=" (geoclue-configuration-wifi-geolocation-url config) "\n"
  318. "submit-data=" (bool (geoclue-configuration-submit-data? config))
  319. "submission-url="
  320. (geoclue-configuration-wifi-submission-url config) "\n"
  321. "submission-nick="
  322. (geoclue-configuration-submission-nick config)
  323. "\n"
  324. (string-join (geoclue-configuration-applications config)
  325. "\n"))))
  326. (define (geoclue-dbus-service config)
  327. (list (wrapped-dbus-service (geoclue-configuration-geoclue config)
  328. "libexec/geoclue"
  329. `(("GEOCLUE_CONFIG_FILE"
  330. ,(geoclue-configuration-file config))))))
  331. (define %geoclue-accounts
  332. (list (user-group (name "geoclue") (system? #t))
  333. (user-account
  334. (name "geoclue")
  335. (group "geoclue")
  336. (system? #t)
  337. (comment "GeoClue daemon user")
  338. (home-directory "/var/empty")
  339. (shell "/run/current-system/profile/sbin/nologin"))))
  340. (define geoclue-service-type
  341. (service-type (name 'geoclue)
  342. (extensions
  343. (list (service-extension dbus-root-service-type
  344. geoclue-dbus-service)
  345. (service-extension account-service-type
  346. (const %geoclue-accounts))))))
  347. (define* (geoclue-service #:key (geoclue geoclue)
  348. (whitelist '())
  349. (wifi-geolocation-url
  350. ;; Mozilla geolocation service:
  351. "https://location.services.mozilla.com/v1/geolocate?key=geoclue")
  352. (submit-data? #f)
  353. (wifi-submission-url
  354. "https://location.services.mozilla.com/v1/submit?key=geoclue")
  355. (submission-nick "geoclue")
  356. (applications %standard-geoclue-applications))
  357. "Return a service that runs the @command{geoclue} location service. This
  358. service provides a D-Bus interface to allow applications to request access to
  359. a user's physical location, and optionally to add information to online
  360. location databases. By default, only the GNOME date-time panel and the Icecat
  361. and Epiphany web browsers are able to ask for the user's location, and in the
  362. case of Icecat and Epiphany, both will ask the user for permission first. See
  363. @uref{https://wiki.freedesktop.org/www/Software/GeoClue/, the geoclue web
  364. site} for more information."
  365. (service geoclue-service-type
  366. (geoclue-configuration
  367. (geoclue geoclue)
  368. (whitelist whitelist)
  369. (wifi-geolocation-url wifi-geolocation-url)
  370. (submit-data? submit-data?)
  371. (wifi-submission-url wifi-submission-url)
  372. (submission-nick submission-nick)
  373. (applications applications))))
  374. ;;;
  375. ;;; Bluetooth.
  376. ;;;
  377. (define-record-type* <bluetooth-configuration>
  378. bluetooth-configuration make-bluetooth-configuration
  379. bluetooth-configuration?
  380. (bluez bluetooth-configuration-bluez (default bluez))
  381. (auto-enable? bluetooth-configuration-auto-enable? (default #f)))
  382. (define (bluetooth-configuration-file config)
  383. "Return a configuration file for the systemd bluetooth service, as a string."
  384. (string-append
  385. "[Policy]\n"
  386. "AutoEnable=" (bool (bluetooth-configuration-auto-enable?
  387. config))))
  388. (define (bluetooth-directory config)
  389. (computed-file "etc-bluetooth"
  390. #~(begin
  391. (mkdir #$output)
  392. (chdir #$output)
  393. (call-with-output-file "main.conf"
  394. (lambda (port)
  395. (display #$(bluetooth-configuration-file config)
  396. port))))))
  397. (define (bluetooth-shepherd-service config)
  398. "Return a shepherd service for @command{bluetoothd}."
  399. (shepherd-service
  400. (provision '(bluetooth))
  401. (requirement '(dbus-system udev))
  402. (documentation "Run the bluetoothd daemon.")
  403. (start #~(make-forkexec-constructor
  404. (list #$(file-append (bluetooth-configuration-bluez config)
  405. "/libexec/bluetooth/bluetoothd"))))
  406. (stop #~(make-kill-destructor))))
  407. (define bluetooth-service-type
  408. (service-type
  409. (name 'bluetooth)
  410. (extensions
  411. (list (service-extension dbus-root-service-type
  412. (compose list bluetooth-configuration-bluez))
  413. (service-extension udev-service-type
  414. (compose list bluetooth-configuration-bluez))
  415. (service-extension etc-service-type
  416. (lambda (config)
  417. `(("bluetooth"
  418. ,(bluetooth-directory config)))))
  419. (service-extension shepherd-root-service-type
  420. (compose list bluetooth-shepherd-service))))
  421. (default-value (bluetooth-configuration))
  422. (description "Run the @command{bluetoothd} daemon, which manages all the
  423. Bluetooth devices and provides a number of D-Bus interfaces.")))
  424. (define* (bluetooth-service #:key (bluez bluez) (auto-enable? #f))
  425. "Return a service that runs the @command{bluetoothd} daemon, which manages
  426. all the Bluetooth devices and provides a number of D-Bus interfaces. When
  427. AUTO-ENABLE? is true, the bluetooth controller is powered automatically at
  428. boot.
  429. Users need to be in the @code{lp} group to access the D-Bus service.
  430. "
  431. (service bluetooth-service-type
  432. (bluetooth-configuration
  433. (bluez bluez)
  434. (auto-enable? auto-enable?))))
  435. ;;;
  436. ;;; Colord D-Bus service.
  437. ;;;
  438. (define %colord-activation
  439. #~(begin
  440. (use-modules (guix build utils))
  441. (mkdir-p "/var/lib/colord")
  442. (let ((user (getpwnam "colord")))
  443. (chown "/var/lib/colord"
  444. (passwd:uid user) (passwd:gid user)))))
  445. (define %colord-accounts
  446. (list (user-group (name "colord") (system? #t))
  447. (user-account
  448. (name "colord")
  449. (group "colord")
  450. (system? #t)
  451. (comment "colord daemon user")
  452. (home-directory "/var/empty")
  453. (shell (file-append shadow "/sbin/nologin")))))
  454. (define colord-service-type
  455. (service-type (name 'colord)
  456. (extensions
  457. (list (service-extension account-service-type
  458. (const %colord-accounts))
  459. (service-extension activation-service-type
  460. (const %colord-activation))
  461. ;; Colord is a D-Bus service that dbus-daemon can
  462. ;; activate.
  463. (service-extension dbus-root-service-type list)
  464. ;; Colord provides "color device" rules for udev.
  465. (service-extension udev-service-type list)
  466. ;; It provides polkit "actions".
  467. (service-extension polkit-service-type list)))
  468. (default-value colord)
  469. (description
  470. "Run @command{colord}, a system service with a D-Bus
  471. interface to manage the color profiles of input and output devices such as
  472. screens and scanners.")))
  473. (define-deprecated (colord-service #:key (colord colord))
  474. colord-service-type
  475. "Return a service that runs @command{colord}, a system service with a D-Bus
  476. interface to manage the color profiles of input and output devices such as
  477. screens and scanners. It is notably used by the GNOME Color Manager graphical
  478. tool. See @uref{http://www.freedesktop.org/software/colord/, the colord web
  479. site} for more information."
  480. (service colord-service-type colord))
  481. ;;;
  482. ;;; UDisks.
  483. ;;;
  484. (define-record-type* <udisks-configuration>
  485. udisks-configuration make-udisks-configuration
  486. udisks-configuration?
  487. (udisks udisks-configuration-udisks
  488. (default udisks)))
  489. (define %udisks-activation
  490. (with-imported-modules '((guix build utils))
  491. #~(begin
  492. (use-modules (guix build utils))
  493. (let ((run-dir "/var/run/udisks2"))
  494. (mkdir-p run-dir)
  495. (chmod run-dir #o700)))))
  496. (define udisks-service-type
  497. (let ((udisks-package (lambda (config)
  498. (list (udisks-configuration-udisks config)))))
  499. (service-type (name 'udisks)
  500. (extensions
  501. (list (service-extension polkit-service-type
  502. udisks-package)
  503. (service-extension dbus-root-service-type
  504. udisks-package)
  505. (service-extension udev-service-type
  506. udisks-package)
  507. (service-extension activation-service-type
  508. (const %udisks-activation))
  509. ;; Profile 'udisksctl' & co. in the system profile.
  510. (service-extension profile-service-type
  511. udisks-package))))))
  512. (define* (udisks-service #:key (udisks udisks))
  513. "Return a service for @uref{http://udisks.freedesktop.org/docs/latest/,
  514. UDisks}, a @dfn{disk management} daemon that provides user interfaces with
  515. notifications and ways to mount/unmount disks. Programs that talk to UDisks
  516. include the @command{udisksctl} command, part of UDisks, and GNOME Disks."
  517. (service udisks-service-type
  518. (udisks-configuration (udisks udisks))))
  519. ;;;
  520. ;;; Elogind login and seat management service.
  521. ;;;
  522. (define-record-type* <elogind-configuration> elogind-configuration
  523. make-elogind-configuration
  524. elogind-configuration?
  525. (elogind elogind-package
  526. (default elogind))
  527. (kill-user-processes? elogind-kill-user-processes?
  528. (default #f))
  529. (kill-only-users elogind-kill-only-users
  530. (default '()))
  531. (kill-exclude-users elogind-kill-exclude-users
  532. (default '("root")))
  533. (inhibit-delay-max-seconds elogind-inhibit-delay-max-seconds
  534. (default 5))
  535. (handle-power-key elogind-handle-power-key
  536. (default 'poweroff))
  537. (handle-suspend-key elogind-handle-suspend-key
  538. (default 'suspend))
  539. (handle-hibernate-key elogind-handle-hibernate-key
  540. ;; (default 'hibernate)
  541. ;; XXX Ignore it for now, since we don't
  542. ;; yet handle resume-from-hibernation in
  543. ;; our initrd.
  544. (default 'ignore))
  545. (handle-lid-switch elogind-handle-lid-switch
  546. (default 'suspend))
  547. (handle-lid-switch-docked elogind-handle-lid-switch-docked
  548. (default 'ignore))
  549. (handle-lid-switch-external-power elogind-handle-lid-switch-external-power
  550. (default 'ignore))
  551. (power-key-ignore-inhibited? elogind-power-key-ignore-inhibited?
  552. (default #f))
  553. (suspend-key-ignore-inhibited? elogind-suspend-key-ignore-inhibited?
  554. (default #f))
  555. (hibernate-key-ignore-inhibited? elogind-hibernate-key-ignore-inhibited?
  556. (default #f))
  557. (lid-switch-ignore-inhibited? elogind-lid-switch-ignore-inhibited?
  558. (default #t))
  559. (holdoff-timeout-seconds elogind-holdoff-timeout-seconds
  560. (default 30))
  561. (idle-action elogind-idle-action
  562. (default 'ignore))
  563. (idle-action-seconds elogind-idle-action-seconds
  564. (default (* 30 60)))
  565. (runtime-directory-size-percent elogind-runtime-directory-size-percent
  566. (default 10))
  567. (runtime-directory-size elogind-runtime-directory-size
  568. (default #f))
  569. (remove-ipc? elogind-remove-ipc?
  570. (default #t))
  571. (suspend-state elogind-suspend-state
  572. (default '("mem" "standby" "freeze")))
  573. (suspend-mode elogind-suspend-mode
  574. (default '()))
  575. (hibernate-state elogind-hibernate-state
  576. (default '("disk")))
  577. (hibernate-mode elogind-hibernate-mode
  578. (default '("platform" "shutdown")))
  579. (hybrid-sleep-state elogind-hybrid-sleep-state
  580. (default '("disk")))
  581. (hybrid-sleep-mode elogind-hybrid-sleep-mode
  582. (default
  583. '("suspend" "platform" "shutdown"))))
  584. (define (elogind-configuration-file config)
  585. (define (yesno x)
  586. (match x
  587. (#t "yes")
  588. (#f "no")
  589. (_ (error "expected #t or #f, instead got:" x))))
  590. (define char-set:user-name
  591. (string->char-set "abcdefghijklmnopqrstuvwxyz0123456789_-"))
  592. (define (valid-list? l pred)
  593. (and-map (lambda (x) (string-every pred x)) l))
  594. (define (user-name-list users)
  595. (unless (valid-list? users char-set:user-name)
  596. (error "invalid user list" users))
  597. (string-join users " "))
  598. (define (enum val allowed)
  599. (unless (memq val allowed)
  600. (error "invalid value" val allowed))
  601. (symbol->string val))
  602. (define (non-negative-integer x)
  603. (unless (exact-integer? x) (error "not an integer" x))
  604. (when (negative? x) (error "negative number not allowed" x))
  605. (number->string x))
  606. (define handle-actions
  607. '(ignore poweroff reboot halt kexec suspend hibernate hybrid-sleep lock))
  608. (define (handle-action x)
  609. (enum x handle-actions))
  610. (define (sleep-list tokens)
  611. (unless (valid-list? tokens char-set:user-name)
  612. (error "invalid sleep list" tokens))
  613. (string-join tokens " "))
  614. (define-syntax ini-file-clause
  615. (syntax-rules ()
  616. ((_ config (prop (parser getter)))
  617. (string-append prop "=" (parser (getter config)) "\n"))
  618. ((_ config str)
  619. (string-append str "\n"))))
  620. (define-syntax-rule (ini-file config file clause ...)
  621. (plain-file file (string-append (ini-file-clause config clause) ...)))
  622. (ini-file
  623. config "logind.conf"
  624. "[Login]"
  625. ("KillUserProcesses" (yesno elogind-kill-user-processes?))
  626. ("KillOnlyUsers" (user-name-list elogind-kill-only-users))
  627. ("KillExcludeUsers" (user-name-list elogind-kill-exclude-users))
  628. ("InhibitDelayMaxSec" (non-negative-integer elogind-inhibit-delay-max-seconds))
  629. ("HandlePowerKey" (handle-action elogind-handle-power-key))
  630. ("HandleSuspendKey" (handle-action elogind-handle-suspend-key))
  631. ("HandleHibernateKey" (handle-action elogind-handle-hibernate-key))
  632. ("HandleLidSwitch" (handle-action elogind-handle-lid-switch))
  633. ("HandleLidSwitchDocked" (handle-action elogind-handle-lid-switch-docked))
  634. ("HandleLidSwitchExternalPower" (handle-action elogind-handle-lid-switch-external-power))
  635. ("PowerKeyIgnoreInhibited" (yesno elogind-power-key-ignore-inhibited?))
  636. ("SuspendKeyIgnoreInhibited" (yesno elogind-suspend-key-ignore-inhibited?))
  637. ("HibernateKeyIgnoreInhibited" (yesno elogind-hibernate-key-ignore-inhibited?))
  638. ("LidSwitchIgnoreInhibited" (yesno elogind-lid-switch-ignore-inhibited?))
  639. ("HoldoffTimeoutSec" (non-negative-integer elogind-holdoff-timeout-seconds))
  640. ("IdleAction" (handle-action elogind-idle-action))
  641. ("IdleActionSec" (non-negative-integer elogind-idle-action-seconds))
  642. ("RuntimeDirectorySize"
  643. (identity
  644. (lambda (config)
  645. (match (elogind-runtime-directory-size-percent config)
  646. (#f (non-negative-integer (elogind-runtime-directory-size config)))
  647. (percent (string-append (non-negative-integer percent) "%"))))))
  648. ("RemoveIPC" (yesno elogind-remove-ipc?))
  649. "[Sleep]"
  650. ("SuspendState" (sleep-list elogind-suspend-state))
  651. ("SuspendMode" (sleep-list elogind-suspend-mode))
  652. ("HibernateState" (sleep-list elogind-hibernate-state))
  653. ("HibernateMode" (sleep-list elogind-hibernate-mode))
  654. ("HybridSleepState" (sleep-list elogind-hybrid-sleep-state))
  655. ("HybridSleepMode" (sleep-list elogind-hybrid-sleep-mode))))
  656. (define (elogind-dbus-service config)
  657. (list (wrapped-dbus-service (elogind-package config)
  658. "libexec/elogind/elogind"
  659. `(("ELOGIND_CONF_FILE"
  660. ,(elogind-configuration-file config))))))
  661. (define (pam-extension-procedure config)
  662. "Return an extension for PAM-ROOT-SERVICE-TYPE that ensures that all the PAM
  663. services use 'pam_elogind.so', a module that allows elogind to keep track of
  664. logged-in users (run 'loginctl' to see elogind's world view of users and
  665. seats.)"
  666. (define pam-elogind
  667. (pam-entry
  668. (control "required")
  669. (module (file-append (elogind-package config)
  670. "/lib/security/pam_elogind.so"))))
  671. (list (lambda (pam)
  672. (pam-service
  673. (inherit pam)
  674. (session (cons pam-elogind (pam-service-session pam)))))))
  675. (define (elogind-shepherd-service config)
  676. "Return a Shepherd service to start elogind according to @var{config}."
  677. (list (shepherd-service
  678. (requirement '(dbus-system))
  679. (provision '(elogind))
  680. (start #~(make-forkexec-constructor
  681. (list #$(file-append (elogind-package config)
  682. "/libexec/elogind/elogind"))
  683. #:environment-variables
  684. (list (string-append "ELOGIND_CONF_FILE="
  685. #$(elogind-configuration-file
  686. config)))))
  687. (stop #~(make-kill-destructor)))))
  688. (define elogind-service-type
  689. (service-type (name 'elogind)
  690. (extensions
  691. (list (service-extension dbus-root-service-type
  692. elogind-dbus-service)
  693. (service-extension udev-service-type
  694. (compose list elogind-package))
  695. (service-extension polkit-service-type
  696. (compose list elogind-package))
  697. ;; Start elogind from the Shepherd rather than waiting
  698. ;; for bus activation. This ensures that it can handle
  699. ;; events like lid close, etc.
  700. (service-extension shepherd-root-service-type
  701. elogind-shepherd-service)
  702. ;; Provide the 'loginctl' command.
  703. (service-extension profile-service-type
  704. (compose list elogind-package))
  705. ;; Extend PAM with pam_elogind.so.
  706. (service-extension pam-root-service-type
  707. pam-extension-procedure)
  708. ;; We need /run/user, /run/systemd, etc.
  709. (service-extension file-system-service-type
  710. (const %elogind-file-systems))))
  711. (default-value (elogind-configuration))))
  712. (define* (elogind-service #:key (config (elogind-configuration)))
  713. "Return a service that runs the @command{elogind} login and seat management
  714. service. The @command{elogind} service integrates with PAM to allow other
  715. system components to know the set of logged-in users as well as their session
  716. types (graphical, console, remote, etc.). It can also clean up after users
  717. when they log out."
  718. (service elogind-service-type config))
  719. ;;;
  720. ;;; Fontconfig and other desktop file-systems.
  721. ;;;
  722. (define %fontconfig-file-system
  723. (file-system
  724. (device "none")
  725. (mount-point "/var/cache/fontconfig")
  726. (type "tmpfs")
  727. (flags '(read-only))
  728. (check? #f)))
  729. ;; The global fontconfig cache directory can sometimes contain stale entries,
  730. ;; possibly referencing fonts that have been GC'd, so mount it read-only.
  731. ;; As mentioned https://debbugs.gnu.org/cgi/bugreport.cgi?bug=36924#8 and
  732. ;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=38046#10 and elsewhere.
  733. (define fontconfig-file-system-service
  734. (simple-service 'fontconfig-file-system
  735. file-system-service-type
  736. (list %fontconfig-file-system)))
  737. ;;;
  738. ;;; AccountsService service.
  739. ;;;
  740. (define %accountsservice-activation
  741. #~(begin
  742. (use-modules (guix build utils))
  743. (mkdir-p "/var/lib/AccountsService")))
  744. (define accountsservice-service-type
  745. (service-type (name 'accountsservice)
  746. (extensions
  747. (list (service-extension activation-service-type
  748. (const %accountsservice-activation))
  749. (service-extension dbus-root-service-type list)
  750. (service-extension polkit-service-type list)))
  751. (default-value accountsservice)))
  752. (define* (accountsservice-service #:key (accountsservice accountsservice))
  753. "Return a service that runs AccountsService, a system service that
  754. can list available accounts, change their passwords, and so on.
  755. AccountsService integrates with PolicyKit to enable unprivileged users to
  756. acquire the capability to modify their system configuration.
  757. @uref{https://www.freedesktop.org/wiki/Software/AccountsService/, the
  758. accountsservice web site} for more information."
  759. (service accountsservice-service-type accountsservice))
  760. ;;;
  761. ;;; cups-pk-helper service.
  762. ;;;
  763. (define cups-pk-helper-service-type
  764. (service-type
  765. (name 'cups-pk-helper)
  766. (description
  767. "PolicyKit helper to configure CUPS with fine-grained privileges.")
  768. (extensions
  769. (list (service-extension dbus-root-service-type list)
  770. (service-extension polkit-service-type list)))
  771. (default-value cups-pk-helper)))
  772. ;;;
  773. ;;; Scanner access via SANE.
  774. ;;;
  775. (define %sane-accounts
  776. ;; The '60-libsane.rules' udev rules refers to the "scanner" group.
  777. (list (user-group (name "scanner") (system? #t))))
  778. (define sane-service-type
  779. (service-type
  780. (name 'sane)
  781. (description
  782. "This service provides access to scanners @i{via}
  783. @uref{http://www.sane-project.org, SANE} by installing the necessary udev
  784. rules.")
  785. (default-value sane-backends-minimal)
  786. (extensions
  787. (list (service-extension udev-service-type list)
  788. (service-extension account-service-type
  789. (const %sane-accounts))))))
  790. ;;;
  791. ;;; GNOME desktop service.
  792. ;;;
  793. (define-record-type* <gnome-desktop-configuration> gnome-desktop-configuration
  794. make-gnome-desktop-configuration
  795. gnome-desktop-configuration?
  796. (gnome gnome-package (default gnome)))
  797. (define (gnome-polkit-settings config)
  798. "Return the list of GNOME dependencies that provide polkit actions and
  799. rules."
  800. (let ((gnome (gnome-package config)))
  801. (map (lambda (name)
  802. ((package-direct-input-selector name) gnome))
  803. '("gnome-settings-daemon"
  804. "gnome-control-center"
  805. "gnome-system-monitor"
  806. "gvfs"))))
  807. (define gnome-desktop-service-type
  808. (service-type
  809. (name 'gnome-desktop)
  810. (extensions
  811. (list (service-extension polkit-service-type
  812. gnome-polkit-settings)
  813. (service-extension profile-service-type
  814. (compose list
  815. gnome-package))))
  816. (default-value (gnome-desktop-configuration))
  817. (description "Run the GNOME desktop environment.")))
  818. (define-deprecated (gnome-desktop-service #:key (config
  819. (gnome-desktop-configuration)))
  820. gnome-desktop-service-type
  821. "Return a service that adds the @code{gnome} package to the system profile,
  822. and extends polkit with the actions from @code{gnome-settings-daemon}."
  823. (service gnome-desktop-service-type config))
  824. ;; MATE Desktop service.
  825. ;; TODO: Add mate-screensaver.
  826. (define-record-type* <mate-desktop-configuration> mate-desktop-configuration
  827. make-mate-desktop-configuration
  828. mate-desktop-configuration?
  829. (mate-package mate-package (default mate)))
  830. (define (mate-polkit-extension config)
  831. "Return the list of packages for CONFIG's MATE package that extend polkit."
  832. (let ((mate (mate-package config)))
  833. (map (lambda (input)
  834. ((package-direct-input-selector input) mate))
  835. '("mate-system-monitor" ;kill, renice processes
  836. "mate-settings-daemon" ;date/time settings
  837. "mate-power-manager" ;modify brightness
  838. "mate-control-center" ;RandR, display properties FIXME
  839. "mate-applets")))) ;CPU frequency scaling
  840. (define mate-desktop-service-type
  841. (service-type
  842. (name 'mate-desktop)
  843. (extensions
  844. (list (service-extension polkit-service-type
  845. mate-polkit-extension)
  846. (service-extension profile-service-type
  847. (compose list
  848. mate-package))))
  849. (default-value (mate-desktop-configuration))
  850. (description "Run the MATE desktop environment.")))
  851. (define-deprecated (mate-desktop-service #:key
  852. (config
  853. (mate-desktop-configuration)))
  854. mate-desktop-service-type
  855. "Return a service that adds the @code{mate} package to the system profile,
  856. and extends polkit with the actions from @code{mate-settings-daemon}."
  857. (service mate-desktop-service-type config))
  858. ;;;
  859. ;;; XFCE desktop service.
  860. ;;;
  861. (define-record-type* <xfce-desktop-configuration> xfce-desktop-configuration
  862. make-xfce-desktop-configuration
  863. xfce-desktop-configuration?
  864. (xfce xfce-package (default xfce)))
  865. (define (xfce-polkit-settings config)
  866. "Return the list of XFCE dependencies that provide polkit actions and
  867. rules."
  868. (let ((xfce (xfce-package config)))
  869. (map (lambda (name)
  870. ((package-direct-input-selector name) xfce))
  871. '("thunar"
  872. "xfce4-power-manager"))))
  873. (define xfce-desktop-service-type
  874. (service-type
  875. (name 'xfce-desktop)
  876. (extensions
  877. (list (service-extension polkit-service-type
  878. xfce-polkit-settings)
  879. (service-extension profile-service-type
  880. (compose list xfce-package))))
  881. (default-value (xfce-desktop-configuration))
  882. (description "Run the Xfce desktop environment.")))
  883. (define-deprecated (xfce-desktop-service #:key (config
  884. (xfce-desktop-configuration)))
  885. xfce-desktop-service-type
  886. "Return a service that adds the @code{xfce} package to the system profile,
  887. and extends polkit with the ability for @code{thunar} to manipulate the file
  888. system as root from within a user session, after the user has authenticated
  889. with the administrator's password."
  890. (service xfce-desktop-service-type config))
  891. ;;;
  892. ;;; X11 socket directory service
  893. ;;;
  894. (define x11-socket-directory-service
  895. ;; Return a service that creates /tmp/.X11-unix. When using X11, libxcb
  896. ;; takes care of creating that directory. However, when using XWayland, we
  897. ;; need to create beforehand. Thus, create it unconditionally here.
  898. (simple-service 'x11-socket-directory
  899. activation-service-type
  900. (with-imported-modules '((guix build utils))
  901. #~(begin
  902. (use-modules (guix build utils))
  903. (let ((directory "/tmp/.X11-unix"))
  904. (mkdir-p directory)
  905. (chmod directory #o777))))))
  906. ;;;
  907. ;;; Enlightenment desktop service.
  908. ;;;
  909. (define-record-type* <enlightenment-desktop-configuration>
  910. enlightenment-desktop-configuration make-enlightenment-desktop-configuration
  911. enlightenment-desktop-configuration?
  912. ;; <package>
  913. (enlightenment enlightenment-package
  914. (default enlightenment)))
  915. (define (enlightenment-setuid-programs enlightenment-desktop-configuration)
  916. (match-record enlightenment-desktop-configuration
  917. <enlightenment-desktop-configuration>
  918. (enlightenment)
  919. (list (file-append enlightenment
  920. "/lib/enlightenment/utils/enlightenment_sys")
  921. (file-append enlightenment
  922. "/lib/enlightenment/utils/enlightenment_system")
  923. (file-append enlightenment
  924. "/lib/enlightenment/utils/enlightenment_ckpasswd"))))
  925. (define enlightenment-desktop-service-type
  926. (service-type
  927. (name 'enlightenment-desktop)
  928. (extensions
  929. (list (service-extension dbus-root-service-type
  930. (compose list
  931. (package-direct-input-selector
  932. "efl")
  933. enlightenment-package))
  934. (service-extension setuid-program-service-type
  935. enlightenment-setuid-programs)
  936. (service-extension profile-service-type
  937. (compose list
  938. enlightenment-package))))
  939. (default-value (enlightenment-desktop-configuration))
  940. (description
  941. "Return a service that adds the @code{enlightenment} package to the system
  942. profile, and extends dbus with the ability for @code{efl} to generate
  943. thumbnails and makes setuid the programs which enlightenment needs to function
  944. as expected.")))
  945. ;;;
  946. ;;; inputattach-service-type
  947. ;;;
  948. (define-record-type* <inputattach-configuration>
  949. inputattach-configuration
  950. make-inputattach-configuration
  951. inputattach-configuration?
  952. (device-type inputattach-configuration-device-type
  953. (default "wacom"))
  954. (device inputattach-configuration-device
  955. (default "/dev/ttyS0"))
  956. (baud-rate inputattach-configuration-baud-rate
  957. (default #f))
  958. (log-file inputattach-configuration-log-file
  959. (default #f)))
  960. (define inputattach-shepherd-service
  961. (match-lambda
  962. (($ <inputattach-configuration> type device baud-rate log-file)
  963. (let ((args (append (if baud-rate
  964. (list "--baud" (number->string baud-rate))
  965. '())
  966. (list (string-append "--" type)
  967. device))))
  968. (list (shepherd-service
  969. (provision '(inputattach))
  970. (requirement '(udev))
  971. (documentation "inputattach daemon")
  972. (start #~(make-forkexec-constructor
  973. (cons (string-append #$inputattach
  974. "/bin/inputattach")
  975. (quote #$args))
  976. #:log-file #$log-file))
  977. (stop #~(make-kill-destructor))))))))
  978. (define inputattach-service-type
  979. (service-type
  980. (name 'inputattach)
  981. (extensions
  982. (list (service-extension shepherd-root-service-type
  983. inputattach-shepherd-service)))
  984. (default-value (inputattach-configuration))
  985. (description "Return a service that runs inputattach on a device and
  986. dispatches events from it.")))
  987. ;;;
  988. ;;; gnome-keyring-service-type
  989. ;;;
  990. (define-record-type* <gnome-keyring-configuration> gnome-keyring-configuration
  991. make-gnome-keyring-configuration
  992. gnome-keyring-configuration?
  993. (keyring gnome-keyring-package (default gnome-keyring))
  994. (pam-services gnome-keyring-pam-services (default '(("gdm-password" . login)
  995. ("passwd" . passwd)))))
  996. (define (pam-gnome-keyring config)
  997. (define (%pam-keyring-entry . arguments)
  998. (pam-entry
  999. (control "optional")
  1000. (module (file-append (gnome-keyring-package config)
  1001. "/lib/security/pam_gnome_keyring.so"))
  1002. (arguments arguments)))
  1003. (list
  1004. (lambda (service)
  1005. (case (assoc-ref (gnome-keyring-pam-services config)
  1006. (pam-service-name service))
  1007. ((login)
  1008. (pam-service
  1009. (inherit service)
  1010. (auth (append (pam-service-auth service)
  1011. (list (%pam-keyring-entry))))
  1012. (session (append (pam-service-session service)
  1013. (list (%pam-keyring-entry "auto_start"))))))
  1014. ((passwd)
  1015. (pam-service
  1016. (inherit service)
  1017. (password (append (pam-service-password service)
  1018. (list (%pam-keyring-entry))))))
  1019. (else service)))))
  1020. (define gnome-keyring-service-type
  1021. (service-type
  1022. (name 'gnome-keyring)
  1023. (extensions (list
  1024. (service-extension pam-root-service-type pam-gnome-keyring)))
  1025. (default-value (gnome-keyring-configuration))
  1026. (description "Return a service, that adds the @code{gnome-keyring} package
  1027. to the system profile and extends PAM with entries using
  1028. @code{pam_gnome_keyring.so}, unlocking a user's login keyring when they log in
  1029. or setting its password with passwd.")))
  1030. ;;;
  1031. ;;; polkit-wheel-service -- Allow wheel group to perform admin actions
  1032. ;;;
  1033. (define polkit-wheel
  1034. (file-union
  1035. "polkit-wheel"
  1036. `(("share/polkit-1/rules.d/wheel.rules"
  1037. ,(plain-file
  1038. "wheel.rules"
  1039. "polkit.addAdminRule(function(action, subject) {
  1040. return [\"unix-group:wheel\"];
  1041. });
  1042. ")))))
  1043. (define polkit-wheel-service
  1044. (simple-service 'polkit-wheel polkit-service-type (list polkit-wheel)))
  1045. ;;;
  1046. ;;; The default set of desktop services.
  1047. ;;;
  1048. (define %desktop-services
  1049. ;; List of services typically useful for a "desktop" use case.
  1050. (cons* (service gdm-service-type)
  1051. ;; Screen lockers are a pretty useful thing and these are small.
  1052. (screen-locker-service slock)
  1053. (screen-locker-service xlockmore "xlock")
  1054. ;; Add udev rules for MTP devices so that non-root users can access
  1055. ;; them.
  1056. (simple-service 'mtp udev-service-type (list libmtp))
  1057. ;; Add udev rules for scanners.
  1058. (service sane-service-type)
  1059. ;; Add polkit rules, so that non-root users in the wheel group can
  1060. ;; perform administrative tasks (similar to "sudo").
  1061. polkit-wheel-service
  1062. ;; Allow desktop users to also mount NTFS and NFS file systems
  1063. ;; without root.
  1064. (simple-service 'mount-setuid-helpers setuid-program-service-type
  1065. (list (file-append nfs-utils "/sbin/mount.nfs")
  1066. (file-append ntfs-3g "/sbin/mount.ntfs-3g")))
  1067. ;; The global fontconfig cache directory can sometimes contain
  1068. ;; stale entries, possibly referencing fonts that have been GC'd,
  1069. ;; so mount it read-only.
  1070. fontconfig-file-system-service
  1071. ;; NetworkManager and its applet.
  1072. (service network-manager-service-type)
  1073. (service wpa-supplicant-service-type) ;needed by NetworkManager
  1074. (simple-service 'network-manager-applet
  1075. profile-service-type
  1076. (list network-manager-applet))
  1077. (service modem-manager-service-type)
  1078. (service usb-modeswitch-service-type)
  1079. ;; The D-Bus clique.
  1080. (service avahi-service-type)
  1081. (udisks-service)
  1082. (service upower-service-type)
  1083. (accountsservice-service)
  1084. (service cups-pk-helper-service-type)
  1085. (service colord-service-type)
  1086. (geoclue-service)
  1087. (service polkit-service-type)
  1088. (elogind-service)
  1089. (dbus-service)
  1090. (service ntp-service-type)
  1091. x11-socket-directory-service
  1092. (service pulseaudio-service-type)
  1093. (service alsa-service-type)
  1094. %base-services))
  1095. ;;; desktop.scm ends here