GNU bug report logs -
#31297
[PATCH] gnu: Add sound service.
Previous Next
Reported by: Oleg Pykhalov <go.wigust <at> gmail.com>
Date: Sat, 28 Apr 2018 10:35:02 UTC
Severity: normal
Tags: patch
Done: Oleg Pykhalov <go.wigust <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #8 received at 31297 <at> debbugs.gnu.org (full text, mbox):
Hello,
Oleg Pykhalov <go.wigust <at> gmail.com> skribis:
> * gnu/services/sound.scm: New file.
> * gnu/local.mk (GNU_SYSTEM_MODULES): Add this.
> * doc/guix.texi (Sound Services): New chapter.
[...]
> +@node Sound Services
> +@subsubsection Sound Services
> +
> +The @code{(gnu services alsa)} module provides an
> +@code{alsa-service-type} service to generate an ALSA
> +@file{/etc/asound.conf} configuration file.
Is this file required to get PulseAudio support? I realize I have
~/.asoundrc that’s similar to what this new service does, so it may be
that I simply forgot that things wouldn’t work well without it.
> +@deffn {Scheme Variable} alsa-service-type
> +This is the type for the @uref{https://alsa-project.org/, alsa},
s/alsa/ALSA/
> +(define-record-type* <alsa-configuration>
> + alsa-configuration make-alsa-configuration alsa-configuration?
> + (pulseaudio? alsa-configuration-pulseaudio? ;boolean
> + (default #t))
> + (extra-options alsa-configuration-extra-options ;string
> + (default #f)))
s/#f/""/ since it’s a string.
> +(define (alsa-config-file config)
> + "Return the ALSA configuration file corresponding to CONFIG."
> + (computed-file
> + "asound.conf"
> + #~(call-with-output-file #$output
> + (lambda (port)
> + (display "# Generated by 'alsa-service'.\n\n" port)
> + (when #$(alsa-configuration-pulseaudio? config)
> + (display "# Use PulseAudio by default
> +pcm.!default {
> + type pulse
> + fallback \"sysdefault\"
> + hint {
> + show on
> + description \"Default ALSA Output (currently PulseAudio Sound Server)\"
> + }
> +}
> +
> +ctl.!default {
> + type pulse
> + fallback \"sysdefault\"
> +}
> +"
> + port))
> + (let ((extra-options #$(alsa-configuration-extra-options config)))
> + (when extra-options (display extra-options port)))))))
I think you could instead write:
(if (alsa-configuration-pulseaudio? config)
(plain-file "asound.conf" (string-append "# Generated by…" extra-options))
(plain-file "asound.conf" extra-options))
> +(define (alsa-activation config)
> + "Return the activation GEXP for CONFIG."
> + (with-imported-modules '((guix build utils))
> + #~(begin
> + (use-modules (guix build utils))
> + (copy-file #$(alsa-config-file config) "/etc/asound.conf"))))
Please extend ‘etc-service-type’ instead.
> +(define alsa-service-type
> + (service-type
> + (name 'alsa)
> + (extensions
> + (list (service-extension activation-service-type alsa-activation)))
> + (default-value (alsa-configuration))
> + (description "Configure the alsa.")))
“Configure low-level Linux sound support, ALSA.”
Thanks,
Ludo’.
This bug report was last modified 7 years and 15 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.