From fd9d0b3530485305033cfea37e0dc96f85209011 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=8A=9F?= Date: Thu, 12 Mar 2026 12:47:36 -0700 Subject: [PATCH] services: dbus: Add rtkit service. * gnu/services/dbus.scm (rtkit-service-type): New variable. (rtkit-configuration): New record. Change-Id: I5078cb5032824c7799e7d26962911bbc67527562 Signed-off-by: Liliana Marie Prikler --- doc/guix.texi | 17 +++++++++++++++++ gnu/services/dbus.scm | 38 +++++++++++++++++++++++++++++++++++++- 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index 476a3e036c..e7bcd174a8 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -27860,6 +27860,23 @@ Log level to output logs. Possible values: @samp{"silent"}, @samp{"error"}, @end table @end deftp +@defvar rtkit-service-type +Type for the service that allows D-Bus to start the RealtimeKit D-Bus +service. The RTKit service provides a system D-Bus interface for user +processes, such as PipeWire, to securely use realtime scheduling. + +The value for this service is a @code{} object. +@end defvar + +@deftp {Data Type} rtkit-configuration +Data type representing the configuration for @code{rtkit-service-type}. + +@table @asis +@item @code{rtkit} (default: @code{rtkit}) (type: file-like) +Package object for RTKit. + +@end table +@end deftp @node Sound Services @subsection Sound Services diff --git a/gnu/services/dbus.scm b/gnu/services/dbus.scm index 76e04bf221..40f2c9264e 100644 --- a/gnu/services/dbus.scm +++ b/gnu/services/dbus.scm @@ -29,6 +29,7 @@ #:use-module ((gnu packages glib) #:select (dbus)) #:use-module (gnu packages polkit) #:use-module (gnu packages admin) + #:use-module (gnu packages freedesktop) #:use-module (guix deprecation) #:use-module (guix gexp) #:use-module ((guix packages) #:select (package-name)) @@ -45,7 +46,10 @@ polkit-configuration polkit-configuration? polkit-service-type - polkit-service)) ; deprecated + polkit-service ; deprecated + + rtkit-configuration + rtkit-service-type)) ;;; ;;; D-Bus. @@ -442,4 +446,36 @@ the capability to suspend the system if the user is logged in locally." (service polkit-service-type (polkit-configuration (polkit polkit)))) +(define-record-type* + rtkit-configuration make-rtkit-configuration + rtkit-configuration? + (rtkit rtkit-configuration-rtkit + (default rtkit))) + +(define %rtkit-account + ;; Account used by rtkit. + (user-account + (name "rtkit") + (group "nogroup") + (system? #t) + (comment "Realtime kit user") + (home-directory "/var/empty") + (shell (file-append shadow "/sbin/nologin")))) + +(define rtkit-service-type + (let ((rtkit-package (compose list rtkit-configuration-rtkit))) + (service-type + (name 'rtkit) + (extensions + (list (service-extension + polkit-service-type rtkit-package) + (service-extension dbus-root-service-type rtkit-package) + (service-extension + account-service-type + (const (list %rtkit-account))))) + (default-value (rtkit-configuration)) + (description + "Return a service that sets up D-Bus and PolKit so that the Realtime Kit +daemon is readily usable.")))) + ;;; dbus.scm ends here