gnu: home: home-pipewire: Add extra-content to configuration.

This allows for setting the default sound card/device, e.g.:

    pcm.!default {type hw card 0 device 2}
    ctl.!default {type hw card 0 device 2}

* gnu/home/services/sound.scm (home-pipewire-configuration)[extra-content]:
New field.
* gnu/home/services/sound.scm (home-pipewire-asoundrc): Append it to
"asoundrc".
* doc/guix.texi (Sound Home Services): Update accordingly.

Change-Id: I6ecebaaab41cd7313b16a5f365c21789db65664e
This commit is contained in:
Janneke Nieuwenhuizen 2024-12-02 21:55:48 +01:00
parent 9525164b38
commit 7080aaf081
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273
2 changed files with 11 additions and 3 deletions

View file

@ -48150,6 +48150,9 @@ The WirePlumber package to use.
@item @code{enable-pulseaudio?} (default: @code{#t}) (type: boolean) @item @code{enable-pulseaudio?} (default: @code{#t}) (type: boolean)
When true, enable PipeWire's PulseAudio emulation support, allowing When true, enable PipeWire's PulseAudio emulation support, allowing
PulseAudio clients to use PipeWire transparently. PulseAudio clients to use PipeWire transparently.
@item @code{extra-content} (default: @code{""}) (type: string)
Extra content to add to the end of @file{~/.config/alsa/asoundrc}.
@end table @end table
@end deftp @end deftp

View file

@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2023 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2023 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2023 Brian Cully <bjc@spork.org> ;;; Copyright © 2023 Brian Cully <bjc@spork.org>
;;; Copyright © 2024 Janneke Nieuwenhuizen <janneke@gnu.org>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -49,7 +50,10 @@ (define-configuration/no-serialization home-pipewire-configuration
(enable-pulseaudio? (enable-pulseaudio?
(boolean #t) (boolean #t)
"When true, enable PipeWire's PulseAudio emulation support, allowing "When true, enable PipeWire's PulseAudio emulation support, allowing
PulseAudio clients to use PipeWire transparently.")) PulseAudio clients to use PipeWire transparently.")
(extra-content
(string "")
"Extra content to add to the end of @file{~/.config/alsa/asoundrc}."))
(define (home-pipewire-shepherd-service config) (define (home-pipewire-shepherd-service config)
(shepherd-service (shepherd-service
@ -93,7 +97,7 @@ (define (home-pipewire-shepherd-services config)
(define (home-pipewire-asoundrc config) (define (home-pipewire-asoundrc config)
(match-record config <home-pipewire-configuration> (match-record config <home-pipewire-configuration>
(pipewire) (pipewire extra-content)
(mixed-text-file (mixed-text-file
"asoundrc" "asoundrc"
"<" pipewire "/share/alsa/alsa.conf.d/50-pipewire.conf>\n" "<" pipewire "/share/alsa/alsa.conf.d/50-pipewire.conf>\n"
@ -103,7 +107,8 @@ (define (home-pipewire-asoundrc config)
"}\n" "}\n"
"ctl_type.pipewire {\n" "ctl_type.pipewire {\n"
" lib \"" pipewire "/lib/alsa-lib/libasound_module_ctl_pipewire.so\"\n" " lib \"" pipewire "/lib/alsa-lib/libasound_module_ctl_pipewire.so\"\n"
"}\n"))) "}\n"
extra-content)))
(define home-pipewire-disable-pulseaudio-auto-start (define home-pipewire-disable-pulseaudio-auto-start
(plain-file "client.conf" "autospawn = no")) (plain-file "client.conf" "autospawn = no"))