services: dbus: Migrate to (gnu system privilege).

* gnu/services/dbus.scm (dbus-setuid-programs): Rename this…
(dbus-privileged-programs): …to this.  Return a <privileged-program> list.
(dbus-root-service-types): Extend PRIVILEGED-PROGRAM-SERVICE-TYPE with it.

Change-Id: I1f1871bb1e9fd1b37aa0c7890356469c3143e8a6
This commit is contained in:
Tobias Geerinckx-Rice 2024-09-08 02:00:00 +02:00
parent 0dd8e4c351
commit c6fe8424e4
No known key found for this signature in database
GPG key ID: 0DB0FF884F556D79

View file

@ -3,6 +3,7 @@
;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
;;; Copyright © 2024 Tobias Geerinckx-Rice <me@tobias.gr>
;;;
;;; This file is part of GNU Guix.
;;;
@ -22,6 +23,7 @@
(define-module (gnu services dbus)
#:use-module (gnu services)
#:use-module (gnu services shepherd)
#:use-module (gnu system privilege)
#:use-module (gnu system setuid)
#:use-module (gnu system shadow)
#:use-module (gnu system pam)
@ -166,13 +168,14 @@ (define %dbus-accounts
(home-directory "/run/dbus")
(shell (file-append shadow "/sbin/nologin")))))
(define dbus-setuid-programs
;; Return a list of <setuid-program> for the program that we need.
(define dbus-privileged-programs
;; Return a list of <privileged-program> for the program that we need.
(match-lambda
(($ <dbus-configuration> dbus services)
(list (setuid-program
(list (privileged-program
(program (file-append
dbus "/libexec/dbus-daemon-launch-helper")))))))
dbus "/libexec/dbus-daemon-launch-helper"))
(setuid? #t))))))
(define (dbus-activation config)
"Return an activation gexp for D-Bus using @var{config}."
@ -255,8 +258,8 @@ (define dbus-root-service-type
dbus-etc-files)
(service-extension account-service-type
(const %dbus-accounts))
(service-extension setuid-program-service-type
dbus-setuid-programs)))
(service-extension privileged-program-service-type
dbus-privileged-programs)))
;; Extensions consist of lists of packages (representing D-Bus
;; services) that we just concatenate.