From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:36672) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ipYL1-0005WW-L2 for guix-patches@gnu.org; Thu, 09 Jan 2020 08:59:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ipYL0-00063n-Er for guix-patches@gnu.org; Thu, 09 Jan 2020 08:59:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:46007) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ipYL0-000630-B0 for guix-patches@gnu.org; Thu, 09 Jan 2020 08:59:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ipYL0-0005yD-AY for guix-patches@gnu.org; Thu, 09 Jan 2020 08:59:02 -0500 Subject: [bug#39052] [PATCH 1/3] services: Add pulseaudio-configuration. Resent-Message-ID: Received: from eggs.gnu.org ([2001:470:142:3::10]:33144) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ipYKD-0005MY-KB for guix-patches@gnu.org; Thu, 09 Jan 2020 08:58:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ipYKB-00035y-Oo for guix-patches@gnu.org; Thu, 09 Jan 2020 08:58:12 -0500 Received: from mailrelay.tugraz.at ([129.27.2.202]:10311) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ipYKB-0002si-CM for guix-patches@gnu.org; Thu, 09 Jan 2020 08:58:11 -0500 Received: from localhost.localdomain (193-80-82-122.hdsl.highway.telekom.at [193.80.82.122]) by mailrelay.tugraz.at (Postfix) with ESMTPSA id 47tnkk4bVTz1DVPn for ; Thu, 9 Jan 2020 14:58:06 +0100 (CET) From: Leo Prikler Date: Thu, 9 Jan 2020 14:57:44 +0100 Message-Id: <20200109135746.1993-2-leo.prikler@student.tugraz.at> In-Reply-To: <20200109135746.1993-1-leo.prikler@student.tugraz.at> References: <20200109135746.1993-1-leo.prikler@student.tugraz.at> 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: 39052@debbugs.gnu.org * gnu/services/sound (): New record. (pulseaudio-etc): New procedure. (pulseaudio-service-type): Update accordingly. --- gnu/services/sound.scm | 47 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/gnu/services/sound.scm b/gnu/services/sound.scm index aaca733729..f01d958ce7 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,61 @@ ctl.!default { ;;; PulseAudio ;;; =20 +(define-record-type* + pulseaudio-configuration make-pulseaudio-configuration + pulseaudio-configuration? + (package pulseaudio-package (default pulseaudio)) + (client-conf pulseaudio-client-conf (default '())) + (daemon-conf pulseaudio-daemon-conf (default '((flat-volumes no)))) + (default-script pulseaudio-default-script (default #f)) + (system-script pulseaudio-system-script (default #f))) + (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 + (($ package client-conf daemon-conf + default-script system-script) + (let ((default.pa (if default-script + (apply mixed-text-file "default.pa" + default-script) + (file-append package "/etc/pulse/default.pa")= ))) + `(("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.pa "\n" + (map pulseaudio-conf-entry daemon-conf))) + ("default.pa" ,default.pa) + ("system.pa" + ,(if system-script + (apply mixed-text-file "system.pa" + system-script) + (file-append package "/etc/pulse/system.pa")))))))))= )) + (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