From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id kOrxJO11emSnbgEASxT56A (envelope-from ) for ; Sat, 03 Jun 2023 01:06:21 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id iODlJO11emSpNgEAauVa8A (envelope-from ) for ; Sat, 03 Jun 2023 01:06:21 +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 435EC396AD for ; Sat, 3 Jun 2023 01:06:21 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q5DqO-0006W0-Oz; Fri, 02 Jun 2023 19:06:04 -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 1q5DqN-0006Vl-7S for guix-patches@gnu.org; Fri, 02 Jun 2023 19:06:03 -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 1q5DqM-0003bD-Ve for guix-patches@gnu.org; Fri, 02 Jun 2023 19:06:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q5DqM-0002dW-Q2 for guix-patches@gnu.org; Fri, 02 Jun 2023 19:06:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#63863] [PATCH] gnu: home: Add support for home-pipewire-service Resent-From: Brian Cully Original-Sender: "Debbugs-submit" Resent-CC: , guix-patches@gnu.org Resent-Date: Fri, 02 Jun 2023 23:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 63863 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 63863@debbugs.gnu.org Cc: Brian Cully , ( , Andrew Tropin , Ludovic =?UTF-8?Q?Court=C3=A8s?= X-Debbugs-Original-To: guix-patches@gnu.org X-Debbugs-Original-Xcc: ( , Andrew Tropin , Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by submit@debbugs.gnu.org id=B.168574713410089 (code B ref -1); Fri, 02 Jun 2023 23:06:02 +0000 Received: (at submit) by debbugs.gnu.org; 2 Jun 2023 23:05:34 +0000 Received: from localhost ([127.0.0.1]:41012 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q5Dpu-0002cf-2N for submit@debbugs.gnu.org; Fri, 02 Jun 2023 19:05:34 -0400 Received: from lists.gnu.org ([209.51.188.17]:39362) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q5Dpr-0002cW-Hg for submit@debbugs.gnu.org; Fri, 02 Jun 2023 19:05:32 -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 1q5Dpr-0006TH-9y for guix-patches@gnu.org; Fri, 02 Jun 2023 19:05:31 -0400 Received: from coleridge.kublai.com ([166.84.7.167] helo=mail.spork.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q5Dpp-0003TB-7q for guix-patches@gnu.org; Fri, 02 Jun 2023 19:05:31 -0400 Received: from psyduck.jhoto.kublai.com (ool-18b8e9e7.dyn.optonline.net [24.184.233.231]) by mail.spork.org (Postfix) with ESMTPSA id 91003D002; Fri, 2 Jun 2023 19:04:42 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=spork.org; s=dkim; t=1685747083; bh=trixCC09+EKP+B1IEuTU2r2r64MHz2Kwb7LDrEIjMSQ=; h=From:To:Cc:Subject:Date; b=DP+CIh2SrwIyxVHxaYAeMHLiChTWtVwgJ8AdvFRba4asAaYefsyVgnK4cP35ip3zy mutAeU0wYDDlrg4sYaOgGmq+7vturhDdBXkWNxU4Bkged/hPfNHXMWsoD9QzeraDlo ySyi+I4cBw9+bZi1SS7IMs+ME4kbGKjWoxh7Bp4E= Date: Fri, 2 Jun 2023 19:04:27 -0400 Message-Id: <13252a733171e18f4d39d0185ddf3e8e3c06bc15.1685747062.git.bjc@spork.org> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=166.84.7.167; envelope-from=bjc@spork.org; helo=mail.spork.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Reply-to: Brian Cully X-ACL-Warn: , Brian Cully via Guix-patches From: Brian Cully via Guix-patches via Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1685747181; h=from:from:sender:sender:reply-to: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=FE88OW0BtO3Wc83pdLALmy+po7EI9W5S3gS1aBpXDB4=; b=LasjlenLBql0Yxa/XER/Y8PQ8QUsPlDY061DYUlXYH/+GgDA7y5Cx9lDQLoZyMzKR6b+m4 1J3Gh3lqXBCwij2jT28Bf7Yx65pCDHCGiLkCph4hGu7bOr4lw3vKcgqHe+tehwy924tOPP 55ffchfOjKAi1tHJTLXqNWJ1vxa1oQQ3dEW/A8070fHBQNgQNTBOdpc2ocAikG3ASHArdZ WzreHTKRuydnWxZUqgZ3GndApudiS6EjyNAxegD5MJ59ScFSkpDo0ZGBEy9D1fhvlMubMi UkApKoUZr8/2YIzNPUpySM/2PEboBd16WmrRibGaqHZXdkxjBaBfMJ32kaeTOQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=spork.org header.s=dkim header.b=DP+CIh2S; dmarc=pass (policy=none) header.from=gnu.org; 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=1685747181; a=rsa-sha256; cv=none; b=ngNq0X/NGV6WYg02G7x6LjEjOJOiYCIfbirDDLvFHlrxoIecEUyGNwxcFkeaKRUwMHUaR9 N7KYwNhZleJ643/N3xeLzIyUANlAmcyZjqMKxndcHDv5Kwdni+joOkrSs01Wn8aLIIeWjl Hu8xw3fBzhgZj1IFdv51o4k+bQGhzNAxu0I3LU87zG9y0AgknKN65KEjVyd4wpD0664c94 0/JMoeDDjjEb5DqzkuuYgcHK4c283SyAAUYDNcLwDRxwljxbfGQHhyXzceArdQM+VMiBi/ yuZxulS0j//IfgxcphSzvdEZY17y8Iv2dZAQUIwOWVwyGa+jI+9Pgi7hfgb56w== X-Migadu-Scanner: scn1.migadu.com X-Migadu-Spam-Score: -3.87 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=spork.org header.s=dkim header.b=DP+CIh2S; dmarc=pass (policy=none) header.from=gnu.org; 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: 435EC396AD X-Spam-Score: -3.87 X-TUID: Z3xuj2vUsTd8 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-service), (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@* 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 +@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 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 © 2023 Ludovic Courtès +;;; Copyright © 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.") + (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-service + (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)))) ;;; @@ -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 -- 2.40.1