From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:38790) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ipjR8-0006um-Hs for guix-patches@gnu.org; Thu, 09 Jan 2020 20:50:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ipjR5-0002GI-9N for guix-patches@gnu.org; Thu, 09 Jan 2020 20:50:04 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:47421) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ipjR5-0002FH-4Z for guix-patches@gnu.org; Thu, 09 Jan 2020 20:50:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ipjR5-0003jb-2H for guix-patches@gnu.org; Thu, 09 Jan 2020 20:50:03 -0500 Subject: [bug#39062] [PATCH 1/6] services: Add pulseaudio-configuration. Resent-Message-ID: Received: from eggs.gnu.org ([2001:470:142:3::10]:36559) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ipjQX-0006Mx-SX for guix-patches@gnu.org; Thu, 09 Jan 2020 20:49:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ipjQW-0007T9-Bm for guix-patches@gnu.org; Thu, 09 Jan 2020 20:49:29 -0500 Received: from mailrelay.tugraz.at ([129.27.2.202]:31226) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ipjQV-0007Be-JU for guix-patches@gnu.org; Thu, 09 Jan 2020 20:49:28 -0500 From: Leo Prikler Date: Fri, 10 Jan 2020 02:48:19 +0100 Message-Id: <20200110014823.10595-1-leo.prikler@student.tugraz.at> In-Reply-To: <87blrc1epy.fsf@devup.no> References: <87blrc1epy.fsf@devup.no> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 39062@debbugs.gnu.org Cc: 39053@debbugs.gnu.org * gnu/services/sound (): New record. (pulseaudio-etc): New procedure. (pulseaudio-service-type): Update accordingly. --- gnu/services/sound.scm | 43 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/gnu/services/sound.scm b/gnu/services/sound.scm index aaca733729..307e62fd1b 100644 --- a/gnu/services/sound.scm +++ b/gnu/services/sound.scm @@ -34,6 +34,7 @@ #:export (alsa-configuration alsa-service-type =20 + pulseaudio-configuration pulseaudio-service-type)) =20 ;;; Commentary: @@ -106,19 +107,57 @@ ctl.!default { ;;; PulseAudio ;;; =20 +(define-record-type* + pulseaudio-configuration make-pulseaudio-configuration + pulseaudio-configuration? + (client-conf pulseaudio-client-conf + (default '())) + (daemon-conf pulseaudio-daemon-conf + (default '())) + (script-file pulseaudio-script-file + (default (file-append pulseaudio "/etc/pulse/default.pa")= )) + (system-script-file pulseaudio-system-script-file + (default + (file-append pulseaudio "/etc/pulse/system.pa"))= )) + (define (pulseaudio-environment config) ;; Define this variable in the global environment such that ;; pulseaudio swh-plugins works. `(("LADSPA_PATH" . ,(file-append swh-plugins "/lib/ladspa")))) =20 +(define (pulseaudio-conf-entry arg) + (match arg + ((key . value) + (format #f "~a =3D ~s~%" key value)) + ((? string? _) + (string-append arg "\n")))) + +(define pulseaudio-etc + (match-lambda + (($ client-conf daemon-conf + default-script-file system-script-fil= e) + `(("pulse" + ,(file-union + "pulse" + `(("client.conf" + ,(apply mixed-text-file "client.conf" + (map pulseaudio-conf-entry client-conf))) + ("daemon.conf" + ,(apply mixed-text-file "daemon.conf" + "default-script-file =3D " default-script-file "\n" + (map pulseaudio-conf-entry daemon-conf))) + ("default.pa" ,default-script-file) + ("system.pa" ,system-script-file)))))))) + (define pulseaudio-service-type (service-type (name 'pulseaudio) (extensions (list (service-extension session-environment-service-type - pulseaudio-environment))) - (default-value #f) + pulseaudio-environment) + (service-extension etc-service-type pulseaudio-etc))) + (default-value (pulseaudio-configuration)) (description "Configure PulseAudio sound support."))) =20 ;;; sound.scm ends here --=20 2.24.1