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