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>
This commit is contained in:
Robert Smith 2019-11-05 23:46:46 +01:00 committed by Tobias Geerinckx-Rice
parent 8f61b53efc
commit 970cb5cece
No known key found for this signature in database
GPG key ID: D889B0F018C5493C

View file

@ -140,6 +140,13 @@ (define (mpd-shepherd-service config)
"--no-daemon" "--no-daemon"
#$(mpd-config->file config)) #$(mpd-config->file config))
#:pid-file #$(mpd-file-name config "pid") #: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"))) #:log-file #$(mpd-file-name config "log")))
(stop #~(make-kill-destructor)))) (stop #~(make-kill-destructor))))