summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author陈功 <andy@andycbruce.com>2026-03-12 12:47:36 -0700
committerLiliana Marie Prikler <liliana.prikler@gmail.com>2026-03-19 07:37:06 +0100
commitfd9d0b3530485305033cfea37e0dc96f85209011 (patch)
treec7ed77cbdcac1b0b4a82a388be2a89661fafbddc
parent9bfbf735b916253c4601ca74b8d3dca6d90584f2 (diff)
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 <liliana.prikler@gmail.com>
-rw-r--r--doc/guix.texi17
-rw-r--r--gnu/services/dbus.scm38
2 files changed, 54 insertions, 1 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index 476a3e036cc..e7bcd174a8e 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -27860,6 +27860,23 @@ Log level to output logs. Possible values: @samp{"silent"}, @samp{"error"},
27860@end table 27860@end table
27861@end deftp 27861@end deftp
27862 27862
27863@defvar rtkit-service-type
27864Type for the service that allows D-Bus to start the RealtimeKit D-Bus
27865service. The RTKit service provides a system D-Bus interface for user
27866processes, such as PipeWire, to securely use realtime scheduling.
27867
27868The value for this service is a @code{<rtkit-configuration>} object.
27869@end defvar
27870
27871@deftp {Data Type} rtkit-configuration
27872Data type representing the configuration for @code{rtkit-service-type}.
27873
27874@table @asis
27875@item @code{rtkit} (default: @code{rtkit}) (type: file-like)
27876Package object for RTKit.
27877
27878@end table
27879@end deftp
27863 27880
27864@node Sound Services 27881@node Sound Services
27865@subsection Sound Services 27882@subsection Sound Services
diff --git a/gnu/services/dbus.scm b/gnu/services/dbus.scm
index 76e04bf2215..40f2c9264ef 100644
--- a/gnu/services/dbus.scm
+++ b/gnu/services/dbus.scm
@@ -29,6 +29,7 @@
29 #:use-module ((gnu packages glib) #:select (dbus)) 29 #:use-module ((gnu packages glib) #:select (dbus))
30 #:use-module (gnu packages polkit) 30 #:use-module (gnu packages polkit)
31 #:use-module (gnu packages admin) 31 #:use-module (gnu packages admin)
32 #:use-module (gnu packages freedesktop)
32 #:use-module (guix deprecation) 33 #:use-module (guix deprecation)
33 #:use-module (guix gexp) 34 #:use-module (guix gexp)
34 #:use-module ((guix packages) #:select (package-name)) 35 #:use-module ((guix packages) #:select (package-name))
@@ -45,7 +46,10 @@
45 polkit-configuration 46 polkit-configuration
46 polkit-configuration? 47 polkit-configuration?
47 polkit-service-type 48 polkit-service-type
48 polkit-service)) ; deprecated 49 polkit-service ; deprecated
50
51 rtkit-configuration
52 rtkit-service-type))
49 53
50;;; 54;;;
51;;; D-Bus. 55;;; D-Bus.
@@ -442,4 +446,36 @@ the capability to suspend the system if the user is logged in locally."
442 (service polkit-service-type 446 (service polkit-service-type
443 (polkit-configuration (polkit polkit)))) 447 (polkit-configuration (polkit polkit))))
444 448
449(define-record-type* <rtkit-configuration>
450 rtkit-configuration make-rtkit-configuration
451 rtkit-configuration?
452 (rtkit rtkit-configuration-rtkit
453 (default rtkit)))
454
455(define %rtkit-account
456 ;; Account used by rtkit.
457 (user-account
458 (name "rtkit")
459 (group "nogroup")
460 (system? #t)
461 (comment "Realtime kit user")
462 (home-directory "/var/empty")
463 (shell (file-append shadow "/sbin/nologin"))))
464
465(define rtkit-service-type
466 (let ((rtkit-package (compose list rtkit-configuration-rtkit)))
467 (service-type
468 (name 'rtkit)
469 (extensions
470 (list (service-extension
471 polkit-service-type rtkit-package)
472 (service-extension dbus-root-service-type rtkit-package)
473 (service-extension
474 account-service-type
475 (const (list %rtkit-account)))))
476 (default-value (rtkit-configuration))
477 (description
478 "Return a service that sets up D-Bus and PolKit so that the Realtime Kit
479daemon is readily usable."))))
480
445;;; dbus.scm ends here 481;;; dbus.scm ends here