summaryrefslogtreecommitdiff
path: root/gnu/services
diff options
context:
space:
mode:
authormuradm <mail@muradm.net>2022-06-15 12:17:41 +0300
committerLars-Dominik Braun <ldb@leibniz-psychology.org>2022-06-17 10:30:43 +0200
commitd6dda325c10a4aa8605fefa3906066ce792c2e81 (patch)
tree0757fe3bce9616f1501639bc63f2952d0a3fb221 /gnu/services
parent167b8f29b3679a23bb20f5ed4181738c389d9d89 (diff)
gnu: desktop: Add seatd-service-type.
* gnu/services/desktop.scm (seatd-service-type): New variable * gnu/services/desktop.scm (seatd-configuration): New data type Signed-off-by: Lars-Dominik Braun <ldb@leibniz-psychology.org>
Diffstat (limited to 'gnu/services')
-rw-r--r--gnu/services/desktop.scm62
1 files changed, 61 insertions, 1 deletions
diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm
index 0499071436..29a3722f1b 100644
--- a/gnu/services/desktop.scm
+++ b/gnu/services/desktop.scm
@@ -13,6 +13,7 @@
;;; Copyright © 2020 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2020 Reza Alizadeh Majd <r.majd@pantherx.org>
;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
+;;; Copyright © 2021 muradm <mail@muradm.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -39,7 +40,9 @@
#:use-module (gnu services networking)
#:use-module (gnu services sound)
#:use-module ((gnu system file-systems)
- #:select (%elogind-file-systems file-system))
+ #:select (%control-groups
+ %elogind-file-systems
+ file-system))
#:autoload (gnu services sddm) (sddm-service-type)
#:use-module (gnu system)
#:use-module (gnu system setuid)
@@ -157,6 +160,9 @@
gnome-keyring-configuration?
gnome-keyring-service-type
+ seatd-configuration
+ seatd-service-type
+
%desktop-services))
;;; Commentary:
@@ -1632,6 +1638,60 @@ or setting its password with passwd.")))
;;;
+;;; seatd-service-type -- minimal seat management daemon
+;;;
+
+(define-record-type* <seatd-configuration> seatd-configuration
+ make-seatd-configuration
+ seatd-configuration?
+ (seatd seatd-package (default seatd))
+ (user seatd-user (default "root"))
+ (group seatd-group (default "users"))
+ (socket seatd-socket (default "/run/seatd.sock"))
+ (logfile seatd-logfile (default "/var/log/seatd.log"))
+ (loglevel seatd-loglevel (default "info")))
+
+(define (seatd-shepherd-service config)
+ (list (shepherd-service
+ (documentation "Minimal seat management daemon")
+ (requirement '())
+ ;; TODO: once cgroups is separate dependency
+ ;; here we should depend on it rather than elogind
+ (provision '(seatd elogind))
+ (start #~(make-forkexec-constructor
+ (list #$(file-append (seatd-package config) "/bin/seatd")
+ "-u" #$(seatd-user config)
+ "-g" #$(seatd-group config))
+ #:environment-variables
+ (list (string-append "SEATD_LOGLEVEL="
+ #$(seatd-loglevel config))
+ (string-append "SEATD_DEFAULTPATH="
+ #$(seatd-socket config)))
+ #:log-file #$(seatd-logfile config)))
+ (stop #~(make-kill-destructor)))))
+
+(define seatd-environment
+ (match-lambda
+ (($ <seatd-configuration> _ _ _ socket)
+ `(("SEATD_SOCK" . ,socket)))))
+
+(define seatd-service-type
+ (service-type
+ (name 'seatd)
+ (description "Seat management takes care of mediating access
+to shared devices (graphics, input), without requiring the
+applications needing access to be root.")
+ (extensions
+ (list
+ (service-extension session-environment-service-type seatd-environment)
+ ;; TODO: once cgroups is separate dependency we should not mount it here
+ ;; for now it is mounted here, because elogind mounts it
+ (service-extension file-system-service-type (const %control-groups))
+ (service-extension shepherd-root-service-type seatd-shepherd-service)))
+ (default-value (seatd-configuration))))
+
+
+;;;
;;; The default set of desktop services.
;;;