unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Janneke Nieuwenhuizen <janneke@gnu.org>
To: 74657@debbugs.gnu.org
Subject: [bug#74657] [PATCH] gnu: home: home-pipewire: Add extra-content to configuration.
Date: Mon,  2 Dec 2024 22:16:28 +0100	[thread overview]
Message-ID: <20241202211630.14201-1-janneke@gnu.org> (raw)

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
---
 doc/guix.texi               |  3 +++
 gnu/home/services/sound.scm | 11 ++++++++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 8a6640124c..f5bd1bc667 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -47289,6 +47289,9 @@ The WirePlumber package to use.
 @item @code{enable-pulseaudio?} (default: @code{#t}) (type: boolean)
 When true, enable PipeWire's PulseAudio emulation support, allowing
 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 deftp
 
diff --git a/gnu/home/services/sound.scm b/gnu/home/services/sound.scm
index 313a57305b..5366c0634f 100644
--- a/gnu/home/services/sound.scm
+++ b/gnu/home/services/sound.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2023 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2023 Brian Cully <bjc@spork.org>
+;;; Copyright © 2024 Janneke Nieuwenhuizen <janneke@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -49,7 +50,10 @@ (define-configuration/no-serialization home-pipewire-configuration
   (enable-pulseaudio?
    (boolean #t)
    "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)
   (shepherd-service
@@ -93,7 +97,7 @@ (define (home-pipewire-shepherd-services config)
 
 (define (home-pipewire-asoundrc config)
   (match-record config <home-pipewire-configuration>
-                (pipewire)
+                (pipewire extra-content)
     (mixed-text-file
      "asoundrc"
      "<" pipewire "/share/alsa/alsa.conf.d/50-pipewire.conf>\n"
@@ -103,7 +107,8 @@ (define (home-pipewire-asoundrc config)
      "}\n"
      "ctl_type.pipewire {\n"
      "  lib \"" pipewire "/lib/alsa-lib/libasound_module_ctl_pipewire.so\"\n"
-     "}\n")))
+     "}\n"
+     extra-content)))
 
 (define home-pipewire-disable-pulseaudio-auto-start
   (plain-file "client.conf" "autospawn = no"))
-- 
2.46.0





                 reply	other threads:[~2024-12-02 21:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=20241202211630.14201-1-janneke@gnu.org \
    --to=janneke@gnu.org \
    --cc=74657@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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).