From 970cb5ceceaa85765230a9f896a43783cdcb4e6c Mon Sep 17 00:00:00 2001 From: Robert Smith Date: Tue, 5 Nov 2019 23:46:46 +0100 Subject: [PATCH] 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 --- gnu/services/audio.scm | 7 +++++++ 1 file changed, 7 insertions(+) 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 @@ (define (mpd-shepherd-service config) "--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))))