all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Leo Prikler <leo.prikler@student.tugraz.at>
To: 39052@debbugs.gnu.org
Subject: [bug#39052] [PATCH 1/3] services: Add pulseaudio-configuration.
Date: Thu,  9 Jan 2020 14:57:44 +0100	[thread overview]
Message-ID: <20200109135746.1993-2-leo.prikler@student.tugraz.at> (raw)
In-Reply-To: <20200109135746.1993-1-leo.prikler@student.tugraz.at>

* gnu/services/sound (<pulseaudio-configuration>): 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
 
+            pulseaudio-configuration
             pulseaudio-service-type))
 
 ;;; Commentary:
@@ -106,19 +107,61 @@ ctl.!default {
 ;;; PulseAudio
 ;;;
 
+(define-record-type* <pulseaudio-configuration>
+  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"))))
 
+(define (pulseaudio-conf-entry arg)
+  (match arg
+    ((key value)
+     (format #f "~a = ~s~%" key value))
+    ((? string? _)
+     (string-append arg "\n"))))
+
+(define pulseaudio-etc
+  (match-lambda
+    (($ <pulseaudio-configuration> 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 = " 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.")))
 
 ;;; sound.scm ends here
-- 
2.24.1

  reply	other threads:[~2020-01-09 13:59 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-09 13:57 [bug#39053] [PATCH] Add pulseaudio configuration and fix volume bugs Leo Prikler
2020-01-09 13:57 ` Leo Prikler [this message]
2020-01-09 13:57 ` [bug#39054] [PATCH 2/3] services: pulseaudio-service-type: Honor /etc Leo Prikler
2020-01-09 13:57 ` [bug#39055] [PATCH 3/3] services: Add pulseaudio to %desktop-services Leo Prikler
2020-01-09 21:50 ` [bug#39053] [PATCH] Add pulseaudio configuration and fix volume bugs Marius Bakke
2020-01-10  1:48   ` [bug#39062] [PATCH 1/6] services: Add pulseaudio-configuration Leo Prikler
2020-01-10  1:48   ` [bug#39061] [PATCH 2/6] services: pulseaudio-service-type: Honor /etc Leo Prikler
2020-01-11 16:57     ` Marius Bakke
2020-01-10  1:48   ` [bug#39053] [PATCH 3/6] services: pulseaudio-configuration: Set flat-volumes to no Leo Prikler
2020-01-11 16:59     ` [bug#39053] [bug#39063] " Marius Bakke
2020-01-10  1:48   ` [bug#39065] [PATCH 4/6] services: Split ladspa-service-type from pulseaudio-service-type Leo Prikler
2020-01-11 17:00     ` [bug#39053] " Marius Bakke
2020-01-10  1:48   ` [bug#39053] [PATCH 5/6] doc: Add pulseaudio documentation Leo Prikler
2020-01-11 17:09     ` [bug#39064] " Marius Bakke
2020-01-11 17:25       ` [bug#39053] " Marius Bakke
2020-01-10  1:48   ` [bug#39066] [PATCH 6/6] services: Add pulseaudio to %desktop-services Leo Prikler
2020-01-11 17:10     ` [bug#39053] " Marius Bakke
2020-01-17 16:30     ` [bug#39053] [bug#39066] " Ludovic Courtès
2020-01-11 17:23 ` bug#38172: [bug#39053] [PATCH] Add pulseaudio configuration and fix volume bugs Marius Bakke
2020-01-11 18:37   ` Leo Prikler
2020-01-11 18:37     ` Leo Prikler
2020-01-11 23:49     ` Marius Bakke
2020-01-12  0:32       ` Leo Prikler
2020-01-12 19:55         ` Marius Bakke
2020-01-12 20:22           ` Leo Prikler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200109135746.1993-2-leo.prikler@student.tugraz.at \
    --to=leo.prikler@student.tugraz.at \
    --cc=39052@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.