3
5
Fork 0
mirror of git://git.savannah.gnu.org/guix.git synced 2023-12-14 03:33:07 +01:00

services: dbus: Remove non-existent directories from 'system-local.conf'.

This typically halves the number of entries in
/etc/dbus-1/system-local.conf.

* gnu/services/dbus.scm (dbus-configuration-directory)[build](directives):
New macro.
(services->sxml): Use it.
This commit is contained in:
Ludovic Courtès 2019-11-01 23:48:40 +01:00
parent 33f9778bc8
commit 27727b18b8
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -86,6 +86,19 @@ includes the @code{etc/dbus-1/system.d} directories of each package listed in
(use-modules (sxml simple)
(srfi srfi-1))
(define-syntax directives
(syntax-rules ()
;; Expand the given directives (SXML expressions) only if their
;; key names a file that exists.
((_ (name directory) rest ...)
(let ((dir directory))
(if (file-exists? dir)
`((name ,dir)
,@(directives rest ...))
(directives rest ...))))
((_)
'())))
(define (services->sxml services)
;; Return the SXML 'includedir' clauses for DIRS.
`(busconfig
@ -98,12 +111,13 @@ includes the @code{etc/dbus-1/system.d} directories of each package listed in
(servicedir "/etc/dbus-1/system-services")
,@(append-map (lambda (dir)
`((includedir
,(string-append dir "/etc/dbus-1/system.d"))
(includedir
,(string-append dir "/share/dbus-1/system.d"))
(servicedir ;for '.service' files
,(string-append dir "/share/dbus-1/services"))))
(directives
(includedir
(string-append dir "/etc/dbus-1/system.d"))
(includedir
(string-append dir "/share/dbus-1/system.d"))
(servicedir ;for '.service' files
(string-append dir "/share/dbus-1/services"))))
services)))
(mkdir #$output)