summary refs log tree commit diff
path: root/gnu/services
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2022-01-31 15:49:31 -0500
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2022-02-26 09:03:01 -0500
commite680c4086178c03eea58c1e987ea2216653dbd6a (patch)
tree6eea3fab138746df708514c2633bb2c6f3cbfd13 /gnu/services
parent60cb647a2807c4ff1ec3eeae589bb985fe7bde28 (diff)
downloadguix-e680c4086178c03eea58c1e987ea2216653dbd6a.tar.gz
services: pulseaudio: Deploy the configuration files to /etc/pulse.
* gnu/services/sound.scm (pulseaudio-environment)
[PULSE_CONFIG, PULSE_CLIENTCONFIG]: Use fixed locations, and move logic to...
(pulseaudio-etc): ... this service extension.  Guard against producing empty
files.
Diffstat (limited to 'gnu/services')
-rw-r--r--gnu/services/sound.scm27
1 files changed, 19 insertions, 8 deletions
diff --git a/gnu/services/sound.scm b/gnu/services/sound.scm
index fca6f13dc5..8410ba2418 100644
--- a/gnu/services/sound.scm
+++ b/gnu/services/sound.scm
@@ -144,11 +144,11 @@ ctl.!default {
 (define pulseaudio-environment
   (match-lambda
     (($ <pulseaudio-configuration> client-conf daemon-conf default-script-file)
-     `(("PULSE_CONFIG" . ,(apply mixed-text-file "daemon.conf"
-                                 "default-script-file = " default-script-file "\n"
-                                 (map pulseaudio-conf-entry daemon-conf)))
-       ("PULSE_CLIENTCONFIG" . ,(apply mixed-text-file "client.conf"
-                                       (map pulseaudio-conf-entry client-conf)))))))
+     ;; These config files kept at a fixed location, so that the following
+     ;; environment values are stable and do not require the user to reboot to
+     ;; effect their PulseAudio configuration changes.
+     '(("PULSE_CONFIG" . "/etc/pulse/daemon.conf")
+       ("PULSE_CLIENTCONFIG" . "/etc/pulse/client.conf")))))
 
 (define (extra-script-files->file-union extra-script-files)
   "Return a G-exp obtained by processing EXTRA-SCRIPT-FILES with FILE-UNION."
@@ -190,8 +190,8 @@ computed-file object~%") file))))
 
 (define pulseaudio-etc
   (match-lambda
-    (($ <pulseaudio-configuration> _ _ default-script-file extra-script-files
-                                   system-script-file)
+    (($ <pulseaudio-configuration> client-conf daemon-conf default-script-file
+                                   extra-script-files system-script-file)
      `(("pulse"
         ,(file-union
           "pulse"
@@ -203,7 +203,18 @@ computed-file object~%") file))))
             ,@(if (null? extra-script-files)
                   '()
                   `(("default.pa.d" ,(extra-script-files->file-union
-                                      extra-script-files)))))))))))
+                                      extra-script-files))))
+            ,@(if (null? daemon-conf)
+                  '()
+                  `(("daemon.conf"
+                     ,(apply mixed-text-file "daemon.conf"
+                             "default-script-file = " default-script-file "\n"
+                             (map pulseaudio-conf-entry daemon-conf)))))
+            ,@(if (null? client-conf)
+                  '()
+                  `(("client.conf"
+                     ,(apply mixed-text-file "client.conf"
+                             (map pulseaudio-conf-entry client-conf))))))))))))
 
 (define pulseaudio-service-type
   (service-type