diff options
author | Ludovic Courtès <ludo@gnu.org> | 2019-11-01 23:48:40 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2019-11-02 00:12:19 +0100 |
commit | 27727b18b8597f7c6fd99adc7797c555aa1c92e9 (patch) | |
tree | 5b0e7a9375bd1aef0fed34d9aa2c89b9a64bf67d /gnu/services/dbus.scm | |
parent | 33f9778bc83086837b99e5c5e99cd514cb0d154e (diff) | |
download | guix-27727b18b8597f7c6fd99adc7797c555aa1c92e9.tar guix-27727b18b8597f7c6fd99adc7797c555aa1c92e9.tar.gz |
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.
Diffstat (limited to 'gnu/services/dbus.scm')
-rw-r--r-- | gnu/services/dbus.scm | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/gnu/services/dbus.scm b/gnu/services/dbus.scm index fcdeb3bf60..a697a8820e 100644 --- a/gnu/services/dbus.scm +++ b/gnu/services/dbus.scm @@ -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) |