summary refs log tree commit diff
path: root/gnu/services
diff options
context:
space:
mode:
authorRobert Smith <robertsmith@posteo.net>2019-11-05 23:46:46 +0100
committerTobias Geerinckx-Rice <me@tobias.gr>2019-11-08 21:32:45 +0100
commit970cb5ceceaa85765230a9f896a43783cdcb4e6c (patch)
tree03d9c383d0a17808b16b54d2cadaa90eee604434 /gnu/services
parent8f61b53efc90ec77c625099a3f2c587115fc64f4 (diff)
downloadguix-970cb5ceceaa85765230a9f896a43783cdcb4e6c.tar.gz
services: mpd: Connect to the user's PulseAudio socket.
* gnu/services/audio.scm (mpd-shepherd-service): Set the XDG_RUNTIME_DIR
environment variable.

Signed-off-by: Tobias Geerinckx-Rice <me@tobias.gr>
Diffstat (limited to 'gnu/services')
-rw-r--r--gnu/services/audio.scm7
1 files changed, 7 insertions, 0 deletions
diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm
index 471c5fd95f..345d8225b2 100644
--- a/gnu/services/audio.scm
+++ b/gnu/services/audio.scm
@@ -140,6 +140,13 @@ audio_output {
                    "--no-daemon"
                    #$(mpd-config->file config))
              #:pid-file #$(mpd-file-name config "pid")
+             #:environment-variables
+             ;; Required to detect PulseAudio when run under a user account.
+             '(#$(string-append
+                   "XDG_RUNTIME_DIR=/run/user/"
+                   (number->string
+                     (passwd:uid
+                       (getpwnam (mpd-configuration-user config))))))
              #:log-file #$(mpd-file-name config "log")))
    (stop  #~(make-kill-destructor))))