services: alsa-service-type: Fix the loading of 'pulse' plugin.
Fixes <https://bugs.gnu.org/31591>. * gnu/services/sound.scm (<alsa-configuration>)[alsa-plugins]: New field. (alsa-config-file): Use 'pcm_type.pulse' and 'ctl_type.pulse' to specify file paths to the 'pulse' plugin. * doc/guix.texi (Sound Services): Document this. Co-authored-by: 宋文武 <iyzsong@member.fsf.org>
This commit is contained in:
parent
a87cb7a73b
commit
1e3861eb00
|
@ -13152,6 +13152,9 @@ See below for details about @code{alsa-configuration}.
|
||||||
Data type representing the configuration for @code{alsa-service}.
|
Data type representing the configuration for @code{alsa-service}.
|
||||||
|
|
||||||
@table @asis
|
@table @asis
|
||||||
|
@item @code{alsa-plugins} (default: @var{alsa-plugins})
|
||||||
|
@code{alsa-plugins} package to use.
|
||||||
|
|
||||||
@item @code{pulseaudio?} (default: @var{#t})
|
@item @code{pulseaudio?} (default: @var{#t})
|
||||||
Whether ALSA applications should transparently be made to use the
|
Whether ALSA applications should transparently be made to use the
|
||||||
@uref{http://www.pulseaudio.org/, PulseAudio} sound server.
|
@uref{http://www.pulseaudio.org/, PulseAudio} sound server.
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#:use-module (guix packages)
|
#:use-module (guix packages)
|
||||||
#:use-module (guix records)
|
#:use-module (guix records)
|
||||||
#:use-module (guix store)
|
#:use-module (guix store)
|
||||||
|
#:use-module (gnu packages linux)
|
||||||
#:use-module (gnu packages pulseaudio)
|
#:use-module (gnu packages pulseaudio)
|
||||||
#:use-module (ice-9 match)
|
#:use-module (ice-9 match)
|
||||||
#:export (alsa-configuration
|
#:export (alsa-configuration
|
||||||
|
@ -44,17 +45,31 @@
|
||||||
|
|
||||||
(define-record-type* <alsa-configuration>
|
(define-record-type* <alsa-configuration>
|
||||||
alsa-configuration make-alsa-configuration alsa-configuration?
|
alsa-configuration make-alsa-configuration alsa-configuration?
|
||||||
|
(alsa-plugins alsa-configuration-alsa-plugins ;<package>
|
||||||
|
(default alsa-plugins))
|
||||||
(pulseaudio? alsa-configuration-pulseaudio? ;boolean
|
(pulseaudio? alsa-configuration-pulseaudio? ;boolean
|
||||||
(default #t))
|
(default #t))
|
||||||
(extra-options alsa-configuration-extra-options ;string
|
(extra-options alsa-configuration-extra-options ;string
|
||||||
(default "")))
|
(default "")))
|
||||||
|
|
||||||
(define (alsa-config-file config)
|
(define alsa-config-file
|
||||||
"Return the ALSA configuration file corresponding to CONFIG."
|
;; Return the ALSA configuration file.
|
||||||
(plain-file "asound.conf"
|
(match-lambda
|
||||||
(string-append "# Generated by 'alsa-service'.\n\n"
|
(($ <alsa-configuration> alsa-plugins pulseaudio? extra-options)
|
||||||
(if (alsa-configuration-pulseaudio? config)
|
(apply mixed-text-file "asound.conf"
|
||||||
"# Use PulseAudio by default
|
`("# Generated by 'alsa-service'.\n\n"
|
||||||
|
,@(if pulseaudio?
|
||||||
|
`("# Use PulseAudio by default
|
||||||
|
pcm_type.pulse {
|
||||||
|
lib \"" ,#~(string-append #$alsa-plugins:pulseaudio
|
||||||
|
"/lib/alsa-lib/libasound_module_pcm_pulse.so") "\"
|
||||||
|
}
|
||||||
|
|
||||||
|
ctl_type.pulse {
|
||||||
|
lib \"" ,#~(string-append #$alsa-plugins:pulseaudio
|
||||||
|
"/lib/alsa-lib/libasound_module_ctl_pulse.so") "\"
|
||||||
|
}
|
||||||
|
|
||||||
pcm.!default {
|
pcm.!default {
|
||||||
type pulse
|
type pulse
|
||||||
fallback \"sysdefault\"
|
fallback \"sysdefault\"
|
||||||
|
@ -67,10 +82,9 @@ pcm.!default {
|
||||||
ctl.!default {
|
ctl.!default {
|
||||||
type pulse
|
type pulse
|
||||||
fallback \"sysdefault\"
|
fallback \"sysdefault\"
|
||||||
}
|
}\n\n")
|
||||||
"
|
'())
|
||||||
"")
|
,extra-options)))))
|
||||||
(alsa-configuration-extra-options config))))
|
|
||||||
|
|
||||||
(define (alsa-etc-service config)
|
(define (alsa-etc-service config)
|
||||||
(list `("asound.conf" ,(alsa-config-file config))))
|
(list `("asound.conf" ,(alsa-config-file config))))
|
||||||
|
|
Loading…
Reference in New Issue