[PATCH 1/3] services: Add pulseaudio-configuration.

  • Done
  • quality assurance status badge
Details
2 participants
  • Leo Prikler
  • Marius Bakke
Owner
unassigned
Submitted by
Leo Prikler
Severity
normal
Merged with

Debbugs page

Leo Prikler wrote 5 years ago
(address . guix-patches@gnu.org)
20200109135746.1993-2-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(-)

Toggle diff (78 lines)
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
Marius Bakke wrote 5 years ago
(address . control@debbugs.gnu.org)
87v9piyluy.fsf@devup.no
merge 39053 39052 39054 39055 39062 39061 39063 39065 39064
thanks
?
Your comment

This issue is archived.

To comment on this conversation send an email to 39052@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 39052
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help