From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:c151::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id INk9LWSyhmRoEAAASxT56A (envelope-from ) for ; Mon, 12 Jun 2023 07:51:32 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:c151::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id SMVbLWSyhmQZDAEA9RJhRA (envelope-from ) for ; Mon, 12 Jun 2023 07:51:32 +0200 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 1736247FED for ; Mon, 12 Jun 2023 07:51:32 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=trop.in header.s=gm1 header.b=J8A4Douv; dmarc=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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1686549092; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: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=UIkdPhjGUbkvPtOf78y8LAUCs3jd5b2z1p9y0soLn/Q=; b=tsuaPjiLbiCx07dylDLtOY8JqjC2skU1vF9e+j6nSdYET3PKyAtf31stws1An+Wgnf0sAr U7SlOtZnMyBaEVn5Mmp6IVToKJF/QD/jhXYl7VLcwb7fXFNVmJUSZo1paZvEmkokTSSbC8 Sp0stXQ9JVj+E7UkWMMUGnbN1FcLTU5eIRZdCIjbZ2Hcngn2ZrYwnflfECjjiV1Dc2ZTSg Auw1qw+gae6gQ5dvADHRqLIEfNeMpjXgcSxyPd9rDbyhKe3a767uDvCFsZ3G4WCp6Pc2TK dqmLBBhOo0NStPfe+1PJAVlmZ1FJb235wwjvjXxTKDb5f+B77YfwKiAr1wYkOg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=trop.in header.s=gm1 header.b=J8A4Douv; dmarc=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" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1686549092; a=rsa-sha256; cv=none; b=jSukRgkfDi2vlPw8dL0Jt+RBj5OCDoRLzfEi2UXG8F8jT3kuV69k62m+3k0fS3ZSWNWG90 ztt0iRO6FW0hzvUghUgfHXl8EI1X6Lm4RSG1d6ZDHy7Z7DJrtWIAt1m7YcP5TgPObHozoY /aeQWCXHWYOeT9nZf6uM6kH/6oPiqpCHQSoxHBn9s5I3AvQt3vsKyveYZkPQWcI2w7LexP XSO3+FhECAhw62ZPY4ySr9eJczeZ6kGFiBvAN/Teyikix6sGmCvdy+N16NRCFm3qSXAWec 9fpT/IZgVL2XjPdSwOfIPr+c1ewyjaET/wiRlLkMOuFl8+1EhwnOn4yYfhxL4g== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q8aSH-00045l-JQ; Mon, 12 Jun 2023 01:51:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q8aSE-00045H-CD for guix-patches@gnu.org; Mon, 12 Jun 2023 01:51:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q8aSE-0002aM-3Z for guix-patches@gnu.org; Mon, 12 Jun 2023 01:51:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q8aSE-0004wh-0D for guix-patches@gnu.org; Mon, 12 Jun 2023 01:51:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#63863] [PATCH] gnu: home: Add support for home-pipewire-service Resent-From: Andrew Tropin Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 12 Jun 2023 05:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63863 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Brian Cully , 63863@debbugs.gnu.org Received: via spool by 63863-submit@debbugs.gnu.org id=B63863.168654904418986 (code B ref 63863); Mon, 12 Jun 2023 05:51:01 +0000 Received: (at 63863) by debbugs.gnu.org; 12 Jun 2023 05:50:44 +0000 Received: from localhost ([127.0.0.1]:38626 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q8aRw-0004wA-22 for submit@debbugs.gnu.org; Mon, 12 Jun 2023 01:50:44 -0400 Received: from relay1-d.mail.gandi.net ([217.70.183.193]:47981) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q8aRu-0004vv-4K for 63863@debbugs.gnu.org; Mon, 12 Jun 2023 01:50:43 -0400 X-GND-Sasl: andrew@trop.in DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=trop.in; s=gm1; t=1686549035; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=UIkdPhjGUbkvPtOf78y8LAUCs3jd5b2z1p9y0soLn/Q=; b=J8A4Douvf+wI9wlhRKU6IepKvdTzt5v2UlzhPv5eBL+n5hCKhV1M3mTagfshWot2N1SBeQ uTc6PrB65CwMgpgMlT0IHT0RNJA7n7eDdRgtR7Cyc1kUt/cMo1DCCEzvUszP7t2aR072p1 N0NNIS5rmJfRXb6I7FNZRNKQQYih+4NzRQEe6zfpqINwhBDsFroGz6Nf4IOJsNhS5/6OUa pZ7faixkG5ghsYI0gvCnJhHm0LWmPqGt0deDr9GGu6fRW/3osRo3DSS1z1/L7gRQDO2cm9 GJSaa935BqmPs4JbGxvOpYLu5/ZtQhpJzmnGfP0CJDzQwtU1MSXcJ2ypamvFgg== X-GND-Sasl: andrew@trop.in Received: by mail.gandi.net (Postfix) with ESMTPSA id 06EBE240004; Mon, 12 Jun 2023 05:50:34 +0000 (UTC) From: Andrew Tropin In-Reply-To: <13252a733171e18f4d39d0185ddf3e8e3c06bc15.1685747062.git.bjc@spork.org> References: <13252a733171e18f4d39d0185ddf3e8e3c06bc15.1685747062.git.bjc@spork.org> Date: Mon, 12 Jun 2023 09:50:31 +0400 Message-ID: <87mt15mdp4.fsf@trop.in> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: UNKNOWN X-Migadu-Flow: FLOW_IN X-Spam-Score: -3.06 X-Migadu-Queue-Id: 1736247FED X-Migadu-Scanner: in3.migadu.com X-Migadu-Spam-Score: -3.06 X-TUID: CXFdml3seWFy --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 2023-06-02 19:04, Brian Cully via Guix-patches via wrote: > This adds a set of home shepherd services which will start the required > services for a functional pipewire setup. > > * gnu/home/services/sound.scm (home-pipewire-shepherd-service), > (home-pipewire-pulse-shepherd-service), (home-wireplumber-shepherd-servic= e), > (home-pipewire-shepherd-services), (generate-doc): new procedures. > (home-pipewire-service-type): new service type. > (home-pipewire-configuration): new struct. > * doc/guix.texi (Sound Home Services): document it. > --- > doc/guix.texi | 34 +++++++++++++++++ > gnu/home/services/sound.scm | 74 ++++++++++++++++++++++++++++++++++++- > 2 files changed, 107 insertions(+), 1 deletion(-) > > diff --git a/doc/guix.texi b/doc/guix.texi > index 7f8d8d66e9..0b19c9301f 100644 > --- a/doc/guix.texi > +++ b/doc/guix.texi > @@ -116,6 +116,7 @@ > Copyright @copyright{} 2023 Karl Hallsby@* > Copyright @copyright{} 2023 Nathaniel Nicandro@* > Copyright @copyright{} 2023 Tanguy Le Carrour@* > +Copyright @copyright{} 2023 Brian Cully@* >=20=20 > Permission is granted to copy, distribute and/or modify this document > under the terms of the GNU Free Documentation License, Version 1.3 or > @@ -43563,6 +43564,39 @@ Sound Home Services > This is the multicast address used by default by the two services above. > @end defvar >=20=20 > +@cindex PipeWire, home service > + > +@uref{https://pipewire.org, PipeWire} provides a low-latency, > +graph-based audio and video processing service. In addition to its > +native protocol, it can also be used as a replacement for both JACK and > +PulseAudio. > + > +@defvar home-pipewire-service-type > +This provides the service definition for @command{pipewire}, which will > +run on login. Its value is a @code{home-pipewire-configuration} object. > + > +To start the service, add it to the @code{service} field of your > +@code{home-environment}, such as: > + > +@lisp > +(service home-pipewire-service-type) > +@end lisp > + > +@deftp {Data Type} home-pipewire-configuration > +Available @code{home-pipewire-configuration} fields are: > + > +@table @asis > +@item @code{pipewire} (default: @code{pipewire}) (type: file-like) > +The PipeWire package to use. > + > +@item @code{wireplumber} (default: @code{wireplumber}) (type: file-like) > +The WirePlumber package to use. > + > +@item @code{enable-pulseaudio?} (default: @code{#t}) (type: boolean) > +Enable PulseAudio replacement. > +@end table > +@end deftp > + > @node Mail Home Services > @subsection Mail Home Services >=20=20=20 > diff --git a/gnu/home/services/sound.scm b/gnu/home/services/sound.scm > index 22c1a99250..94d8bc7482 100644 > --- a/gnu/home/services/sound.scm > +++ b/gnu/home/services/sound.scm > @@ -1,5 +1,6 @@ > ;;; GNU Guix --- Functional package management for GNU > ;;; Copyright =C2=A9 2023 Ludovic Court=C3=A8s > +;;; Copyright =C2=A9 2023 Brian Cully > ;;; > ;;; This file is part of GNU Guix. > ;;; > @@ -19,13 +20,77 @@ > (define-module (gnu home services sound) > #:use-module (gnu home services) > #:use-module (gnu home services shepherd) > + #:use-module (gnu packages linux) > + #:use-module (gnu services configuration) > #:use-module (guix records) > #:use-module (guix gexp) > #:use-module (srfi srfi-1) > + #:use-module (srfi srfi-26) > #:use-module (ice-9 match) > #:export (home-pulseaudio-rtp-sink-service-type > home-pulseaudio-rtp-source-service-type > - %pulseaudio-rtp-multicast-address)) > + %pulseaudio-rtp-multicast-address > + > + home-pipewire-configuration > + home-pipewire-service-type)) > + > + > +;;; > +;;; PipeWire support. > +;;; > +(define-configuration/no-serialization home-pipewire-configuration > + (pipewire (file-like pipewire) "The PipeWire package to use.") > + (wireplumber (file-like wireplumber) "The WirePlumber package to use.") > + (enable-pulseaudio? (boolean #t) "Enable PulseAudio replacement.")) > + > +(define (home-pipewire-shepherd-service config) > + (shepherd-service > + (documentation "PipeWire screen and audio sharing.") The description seems a little bit missleading, while PipeWire can do screensharing, it's not only or even primary role. > + (provision '(pipewire)) > + (requirement '(dbus)) > + (start #~(make-forkexec-constructor > + (list #$(file-append > + (home-pipewire-configuration-pipewire config) > + "/bin/pipewire")))))) > + > +(define (home-pipewire-pulseaudio-shepherd-service config) > + (shepherd-service > + (documentation "Drop-in PulseAudio replacement service for PipeWire.") > + (provision '(pipewire-pulseaudio)) > + (requirement '(pipewire)) > + (start #~(make-forkexec-constructor > + (list #$(file-append > + (home-pipewire-configuration-pipewire config) > + "/bin/pipewire-pulse")))))) > + > +(define (home-wireplumber-shepherd-service config) > + (shepherd-service > + (documentation "WirePlumber session management for PipeWire.") > + (provision '(wireplumber)) > + (requirement '(pipewire)) > + (start #~(make-forkexec-constructor > + (list #$(file-append > + (home-pipewire-configuration-wireplumber config) > + "/bin/wireplumber")))))) > + > +(define (home-pipewire-shepherd-services config) > + (define shepherd-services > + (filter > + identity > + (list home-pipewire-shepherd-service home-wireplumber-shepherd-serv= ice > + (and (home-pipewire-configuration-enable-pulseaudio? config) > + home-pipewire-pulseaudio-shepherd-service)))) > + (map (cut <> config) shepherd-services)) > + > +(define home-pipewire-service-type > + (service-type > + (name 'pipewire) > + (extensions > + (list (service-extension home-shepherd-service-type > + home-pipewire-shepherd-services))) > + (description > + "Start essential PipeWire services.") > + (default-value (home-pipewire-configuration)))) >=20=20 > > ;;; > @@ -149,3 +214,10 @@ (define home-pulseaudio-rtp-source-service-type > "Define a PulseAudio source to receive audio broadcasted over RTP by > another PulseAudio instance.") > (default-value %pulseaudio-rtp-multicast-address))) > + > + > +;;; > +;;; Generate documentation. > +;;; > +(define (generate-doc) > + (configuration->documentation 'home-pipewire-configuration)) > > base-commit: c11b92a8aae6fe7fad0da8257ec28f5009c37b35 Hi Brian, Thank you for the patch! You may also want to add pipewire backend for alsa: https://git.sr.ht/~abcdw/rde/tree/525f8c7f25783c6b8fa55f21c8e62237bc0d4a04/= src/rde/features/linux.scm#L100 =2D-=20 Best regards, Andrew Tropin --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmSGsicACgkQIgjSCVjB 3rClnxAAjAYXIoPx3Eorh6icMEkTOfYTJUQ7eyIgjfzt0hUw6K4tNE6v3A3XqgZh pmvXV/r4LSibZloZkYDZF15/vwaTwqiGQwuRVP38XtLD58BzKWRSBieIwkO0kQZg 4bXpftBgFMC/6+4YR+9R7koMRAZt8hNQyY3AcrAj+6wOjCxdi/unXq5fhAXR7VKS sceeCzKIwzgeWwKbDZ3wp1ncVbgQ+IjNOSjXSyBfrTtYTAAPVxgx4S8BeRWznPPt ldBaMswvTduXeNFxgAHAUBcsQTEV8SFdtnsX66az6woyrf29/i/7636ZGyYe9ZaS bmbCMNlCfSsGutjvrbGfRdC+u59pYHMZ592+jEu21UAAI1Gff/dS4Pc7dfGxoZtG FKMYPOoB+hyGK/Eeo7uNCtoRCVvElhX2ql/6erpPhqruB8zT0xeHNIAJf1KSHxzr a3u96DroKtsTgmB7iEC5L51j/ojGmNohz98DB05CjPyEICGa/MAzUU0Qm25uRnD8 6H0SI1MKPYpq3q85XqXUSrvz54PyT86QycgsdgAeP4NPAskn+7JkpRUSknVBc4gn icYxCogyn9rFVeFsD3Dgr7xnZ9D+DN3TTKPtZYPysFF7cYgVXGNvb8dbPvfeknpI GS8tek+m/dt0TnrjANjMjJ3s7l/2vgLlbfOHVfSIy138kMa/KxE= =cRyd -----END PGP SIGNATURE----- --=-=-=--