From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id YMSfLIvm+WH47gAAgWs5BA (envelope-from ) for ; Wed, 02 Feb 2022 03:03:55 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id yDpuJYvm+WEelgAAG6o9tA (envelope-from ) for ; Wed, 02 Feb 2022 03:03:55 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id C73C41610B for ; Wed, 2 Feb 2022 03:03:54 +0100 (CET) Received: from localhost ([::1]:49448 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nF4zx-0001Bn-UL for larch@yhetil.org; Tue, 01 Feb 2022 21:03:53 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44922) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nEzly-0003wk-Kt for guix-patches@gnu.org; Tue, 01 Feb 2022 15:29:08 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:51359) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nEzlu-0002Fj-0M for guix-patches@gnu.org; Tue, 01 Feb 2022 15:29:05 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nEzlt-00024f-TE for guix-patches@gnu.org; Tue, 01 Feb 2022 15:29:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53676] [PATCH 4/5] services: pulseaudio: Add an extra-script-files configuration field. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 01 Feb 2022 20:29:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53676 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Liliana Marie Prikler Cc: 53676@debbugs.gnu.org Received: via spool by 53676-submit@debbugs.gnu.org id=B53676.16437472837901 (code B ref 53676); Tue, 01 Feb 2022 20:29:01 +0000 Received: (at 53676) by debbugs.gnu.org; 1 Feb 2022 20:28:03 +0000 Received: from localhost ([127.0.0.1]:44262 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nEzkw-00023N-IU for submit@debbugs.gnu.org; Tue, 01 Feb 2022 15:28:02 -0500 Received: from mail-qt1-f173.google.com ([209.85.160.173]:43591) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nEzku-00022q-D6 for 53676@debbugs.gnu.org; Tue, 01 Feb 2022 15:28:00 -0500 Received: by mail-qt1-f173.google.com with SMTP id x5so2406971qtw.10 for <53676@debbugs.gnu.org>; Tue, 01 Feb 2022 12:28:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=Tu08mJNk/EGB23ZoYqw857FgrgCIECCHAF97VEoudpw=; b=Hff6Md6pKqYejdVUiE9dahcweL9w5UTCnmzqpOQmB/83U/vH2mJzzXkztkUmTNztRw KAL04JYQTb/etgnfbWxwouAzQluVVMLIFIyjcePUVc+zEWjaoJj3L02ZG6YPOWUvnngm HpxVOxrmwcpK9Xttzvbwy0inS9hW+rAPRhD3ROjkkdBBCJCZF4Cyrm81t3LxxWT9xf2q quCoCqMqYwNvk3B0AqimpfT/AEGcCLHaUwa66XUiv+ji5B7aNLpBLJeCYF+623tyUZKg k3S+4GhUZp3AqFeQtXIqKFli6SXLkEM1XKyMhBUi1eFPK8RU6J60K+kUjGdKI2pwG7xx wB/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=Tu08mJNk/EGB23ZoYqw857FgrgCIECCHAF97VEoudpw=; b=iDgKSk24roJth7NgT9Ft2mIqMh04L6Day2SSr+4dQPjPLLWVCHnMaBkuf65aVZA/hv vg5gCEqBD5OJdxTbSvcIjX0V6dIhXKGefwkpWrFjkO/INoIV3czuBanzE3gvHmwsYzrm MjMDC40IePwLH+axY+atQdiJp+WUsc0nawOSczCI3h/hmJH2cisfKFCq28ujmbjmIrBu pMT28EPycbOyoKSCaxPEZTxzT0diNY9IRrsuiZqT03mgPWIz1x1TouDJAJwnoHoqFaD3 5QLnRFE5USO0M6OqMH7w5U7V1zmRklRUr8lzzmYbAT8vR4WeS9ulSdwFVBTCkqr+L6Cg qxzg== X-Gm-Message-State: AOAM531ym8DMoRqah/uyZQq+bGTHF6kikY1KBx2f7w2uYcDZx1Dr0CiP B0u8gelnVxea8Wi90yO6w19YpsPZeyQ= X-Google-Smtp-Source: ABdhPJyfZpR/UZ+teJs2jvyG8AsGiATPysSJFlONeEpRjwDyRaC5cCJpKRivSLn2dj42NLE9/lAiuQ== X-Received: by 2002:ac8:58c3:: with SMTP id u3mr15453261qta.457.1643747274530; Tue, 01 Feb 2022 12:27:54 -0800 (PST) Received: from hurd (dsl-149-193.b2b2c.ca. [66.158.149.193]) by smtp.gmail.com with ESMTPSA id x11sm10443420qkm.108.2022.02.01.12.27.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Feb 2022 12:27:54 -0800 (PST) From: Maxim Cournoyer References: <20220201041933.16603-1-maxim.cournoyer@gmail.com> <20220201041933.16603-4-maxim.cournoyer@gmail.com> <97111754acacc576aec4eb55889a32474fe71f95.camel@gmail.com> Date: Tue, 01 Feb 2022 15:27:53 -0500 In-Reply-To: <97111754acacc576aec4eb55889a32474fe71f95.camel@gmail.com> (Liliana Marie Prikler's message of "Tue, 01 Feb 2022 20:56:28 +0100") Message-ID: <871r0m1gdy.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1643767434; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=Tu08mJNk/EGB23ZoYqw857FgrgCIECCHAF97VEoudpw=; b=MkMxMl4BDSeMnPZJBZhRPB1X93u4JbGPsRTrevKtu7ZHRPi5OlfmMeH0Gw7kJZyk2PaFkr DaUoOrZ06EbpFNAo0B2v/0m5T4IMKBWFEUtDDYKwShmK4k7/zepQhGeylpSV9hixoPpyQ8 b3FbUy5wKm/SCQApEjOPwg6G/BYC6Gdsng/GTTzpsPRlo+TE4xd/YSet/H7YMqTPVhORsr 2mh5AzHG/Iszxy3RFTMcLhGtjXq+kggJrrQu18qJF4V/2eCP6/Z6rcyRLmyPhTVSYgplpA ss0ePiTbCHIvU4cJUnvFzjBUxXu56jmL8yoTLZRnGWgTiHd5lwkc+LwjhAllTQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1643767434; a=rsa-sha256; cv=none; b=AaCAEfOsMWCefJY/B4wx81cu3GJZkBU/OLl6gUJetH4e51IIFrmYEzmBwx0DWPNb5ZAAZX 0SNAfb9z5zjhLI/RRzQ542faX9fXuwB4pYoh9ASTI00E0YvZjLHarL0OAaVhTNOFoUiQjh EKJpKsYIyBwyJyZ2KFObDAA6FyzDsvhFGe0tJNmrs3tjoBm9GzYpYBzGuJPkjcELCam/rt 2BjipvpNcQAM5nvFvTgXXSQsd7TMlkq+iHoM6qScrJ3ootya1h16gDx41ZurPH502GnHNK fChYYcrZLOyGT/pk0UaTdUEZeDkJGss7Y/exYCO7GRmQ5Uu3kw7S3AJOKbBqew== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=Hff6Md6p; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -2.53 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=Hff6Md6p; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: C73C41610B X-Spam-Score: -2.53 X-Migadu-Scanner: scn0.migadu.com X-TUID: 0xoMVKx5plDD Hi Liliana, Liliana Marie Prikler writes: > Hi, > > Am Montag, dem 31.01.2022 um 23:19 -0500 schrieb Maxim Cournoyer: >> * gnu/services/sound.scm () >> [extra-script-files]: Add field. >> (extra-script-files->file-union): Add procedure. >> (pulseaudio-etc): Use it. >> * doc/guix.texi: Document it. >> --- >> =C2=A0doc/guix.texi=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 | 27 +++++++++++++++++++++++++++ >> =C2=A0gnu/services/sound.scm | 19 +++++++++++++++++-- >> =C2=A02 files changed, 44 insertions(+), 2 deletions(-) >>=20 >> diff --git a/doc/guix.texi b/doc/guix.texi >> index a002670030..2f8df03461 100644 >> --- a/doc/guix.texi >> +++ b/doc/guix.texi >> @@ -21393,9 +21393,36 @@ List of settings to set in >> @file{daemon.conf}, formatted just like >> =C2=A0@item @code{script-file} (default: @code{(file-append pulseaudio >> "/etc/pulse/default.pa")}) >> =C2=A0Script file to use as @file{default.pa}. >> =C2=A0 >> +@item @code{extra-script-files} (default: @code{'())}) >> +A list of file-like objects defining extra PulseAudio scripts to run >> at >> +the initialization of the @command{pulseaudio} daemon.=C2=A0 For a >> reference >> +of the available commands, refer to @command{man pulse-cli-syntax}. >> + >> =C2=A0@item @code{system-script-file} (default: @code{(file-append >> pulseaudio "/etc/pulse/system.pa")}) >> =C2=A0Script file to use as @file{system.pa}. >> =C2=A0@end table >> + >> +The example below sets the default PulseAudio card profile, the >> default >> +sink and the default source to use for a old SoundBlaster Audigy >> sound >> +card: >> +@lisp >> +(pulseaudio-configuration >> + (extra-script-files >> +=C2=A0 (list (plain-file "configure-audigy-card" >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (string-append "\ >> +set-card-profile alsa_card.pci-0000_01_01.0 \ >> +=C2=A0 output:analog-surround-40+input:analog-mono >> +set-default-source alsa_input.pci-0000_01_01.0.analog-mono >> +set-default-sink alsa_output.pci-0000_01_01.0.analog-surround- >> 40\n"))))) >> +@end lisp >> + >> +Note that @code{pulseaudio-service-type} is part of >> +@code{%desktop-services}; if your operating system declaration was >> +derived from one of the desktop templates, you'll want to adjust the >> +above example to modify the existing @code{pulseaudio-service-type} >> via >> +@code{modify-services} (@pxref{Service Reference, >> +@code{modify-services}}), instead of defining a new one. >> + >> =C2=A0@end deftp >> =C2=A0 >> =C2=A0@deffn {Scheme Variable} ladspa-service-type >> diff --git a/gnu/services/sound.scm b/gnu/services/sound.scm >> index 19eccfc860..f529188a7c 100644 >> --- a/gnu/services/sound.scm >> +++ b/gnu/services/sound.scm >> @@ -34,6 +34,7 @@ (define-module (gnu services sound) >> =C2=A0=C2=A0 #:use-module (gnu packages linux) >> =C2=A0=C2=A0 #:use-module (gnu packages pulseaudio) >> =C2=A0=C2=A0 #:use-module (ice-9 match) >> +=C2=A0 #:use-module (srfi srfi-1) >> =C2=A0=C2=A0 #:export (alsa-configuration >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= alsa-service-type >> =C2=A0 >> @@ -125,6 +126,8 @@ (define-record-type* >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 (default '((flat-volumes . no)))) >> =C2=A0=C2=A0 (script-file pulseaudio-configuration-script-file >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 (default (file-append pulseaudio >> "/etc/pulse/default.pa"))) >> +=C2=A0 (extra-script-files pulseaudio-configuration-extra-script-files >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (default '())) >> =C2=A0=C2=A0 (system-script-file pulseaudio-configuration-system-script-= file >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (default >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (f= ile-append pulseaudio >> "/etc/pulse/system.pa")))) >> @@ -145,14 +148,26 @@ (define pulseaudio-environment >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ("PULSE_CLIENTCONFIG" . ,(app= ly mixed-text-file "client.conf" >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 (map pulseaudio-conf-entry >> client-conf))))))) >> =C2=A0 >> +(define (extra-script-files->file-union extra-script-files) >> +=C2=A0 "Return a G-exp obtained by processing EXTRA-SCRIPT-FILES with >> FILE-UNION. >> +Each file is named \"snippet-n.pa\", where N is their 1-offset >> index." >> +=C2=A0 (let ((labels (map (lambda (n) (format #f "snippet-~a.pa" n)) >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (iota (length extra-scr= ipt-files) 1)))) >> +=C2=A0=C2=A0=C2=A0 (file-union "default.pa.d" (zip labels extra-script-= files)))) >> + >> =C2=A0(define pulseaudio-etc >> =C2=A0=C2=A0 (match-lambda >> -=C2=A0=C2=A0=C2=A0 (($ _ _ default-script-fi= le system- >> script-file) >> +=C2=A0=C2=A0=C2=A0 (($ _ _ default-script-fi= le extra- >> script-files >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 system-script-= file) >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 `(("pulse" >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ,(file-union >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 "pulse" >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 `(("default= .pa" ,default-script-file) >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ("sy= stem.pa" ,system-script-file)))))))) >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ("sy= stem.pa" ,system-script-file) >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ,@(i= f (null? extra-script-files) >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 '() >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 `(("default.pa.d" ,(extra-script-files->f= ile-union >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 extra-script-files))))))))))) >> =C2=A0 >> =C2=A0(define pulseaudio-service-type >> =C2=A0=C2=A0 (service-type > Is there a particular use-case for this (other than working around the > location issue of default.pa et al.)? If not, I'd rather make it s.t. > our other files can more easily be stitched together in-place. You mean, a use case for extra-script-files? Sorry, I missed something in the "make it s.t. our other [...]"; what does "s.t." stands for? My use case is the one I documented in the manual; setting a default card profile for example. Also choosing the default sink and source of a card; this can be done in client.conf but that doesn't get reflected anywhere on the state of a running pulseaudio server it seems, contrary to calling 'set-default-sink ...', which takes effect server-side. > Also, assuming that we're using file-like objects here, I think we > should use the store name minus prefix and hash for the file name.=20 > E.g. if Alice adds soundblaster.pa, it'd make sense to label it > soundblaster.pa, so that changes to snippet order don't mess up any > configuration referring to those files. I actually wanted to do that but decided against since there's no clean API to retrieve the name of a G-Exp file-like object (it could be done, currently, but it'd be messy and fragile, it seems). But good observation, I wanted to document that the extra script files are loaded in the order they are listed. Maxim