From: Sughosha via Guix-patches via <guix-patches@gnu.org>
To: 66877@debbugs.gnu.org
Cc: Sughosha <sughosha@proton.me>
Subject: [bug#66877] [WIP PATCH 1/1] gnu: home: services: Add home-pipewire.
Date: Wed, 1 Nov 2023 11:14:42 +0100 [thread overview]
Message-ID: <d2c4964c80599cc20fd981dc76827e52d45d40ea.1698833388.git.sughosha@disroot.org> (raw)
In-Reply-To: <cover.1698833388.git.sughosha@disroot.org>
From: Sughosha <sughosha@proton.me>
* gnu/home/services/sound.scm (home-pipewire-service-type):
New variable.
---
gnu/home/services/sound.scm | 90 ++++++++++++++++++++++++++++++++++++-
1 file changed, 89 insertions(+), 1 deletion(-)
diff --git a/gnu/home/services/sound.scm b/gnu/home/services/sound.scm
index 22c1a99250..16bfe92f2f 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 <ludo@gnu.org>
+;;; Copyright © 2023 Sughosha <sughosha@proton.me>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -18,14 +19,20 @@
(define-module (gnu home services sound)
#:use-module (gnu home services)
+ #:use-module (gnu home services desktop)
#:use-module (gnu home services shepherd)
+ #:use-module (gnu packages linux)
+ #:use-module (gnu packages pulseaudio)
+ #:use-module (guix packages)
#:use-module (guix records)
#:use-module (guix gexp)
#:use-module (srfi srfi-1)
#: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-service-type))
\f
;;;
@@ -149,3 +156,84 @@ (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)))
+
+;;;
+;;; PipeWire support.
+;;;
+
+(define (home-pipewire-files-service config)
+ `((".asoundrc"
+ ,(mixed-text-file
+ "asoundrc"
+ #~(string-append
+ "<"
+ #$(file-append
+ pipewire
+ "/share/alsa/alsa.conf.d/50-pipewire.conf")
+ ">\n<"
+ #$(file-append
+ pipewire
+ "/share/alsa/alsa.conf.d/99-pipewire-default.conf")
+ ">\n"
+ "
+pcm_type.pipewire {
+ lib " #$(file-append
+ pipewire
+ "/lib/alsa-lib/libasound_module_pcm_pipewire.so") "
+}
+
+ctl_type.pipewire {
+ lib " #$(file-append
+ pipewire
+ "/lib/alsa-lib/libasound_module_ctl_pipewire.so") "
+}\n
+defaults.pcm.card 2\n
+defaults.ctl.card 2")))))
+
+(define (home-pipewire-shepherd-service config)
+ (list
+ (shepherd-service
+ (requirement '(dbus))
+ (provision '(pipewire))
+ (stop #~(make-kill-destructor))
+ (start #~(make-forkexec-constructor
+ (list #$(file-append pipewire "/bin/pipewire")))))
+ (shepherd-service
+ (requirement '(pipewire))
+ (provision '(wireplumber))
+ (stop #~(make-kill-destructor))
+ (start #~(make-forkexec-constructor
+ (list #$(file-append wireplumber "/bin/wireplumber")))))
+ #;
+ (shepherd-service
+ (requirement '(pipewire))
+ (provision '(pipewire-media-session))
+ (stop #~(make-kill-destructor))
+ (start #~(make-forkexec-constructor
+ (list
+ #$(file-append
+ pipewire-media-session
+ "/bin/pipewire-media-session")
+ "-c"
+ #$(file-append
+ pipewire-media-session
+ "/share/pipewire/media-session.d/media-session.conf")))))
+ (shepherd-service
+ (requirement '(pipewire))
+ (provision '(pipewire-pulse))
+ (stop #~(make-kill-destructor))
+ (start #~(make-forkexec-constructor
+ (list #$(file-append pipewire "/bin/pipewire-pulse")))))))
+
+(define home-pipewire-service-type
+ (service-type
+ (name 'home-pipewire)
+ (extensions
+ (list (service-extension home-files-service-type
+ home-pipewire-files-service)
+ (service-extension home-shepherd-service-type
+ home-pipewire-shepherd-service)
+ (service-extension home-profile-service-type
+ (const (list pipewire pulseaudio)))))
+ (default-value '())
+ (description "Configure PipeWire sound support.")))
--
2.41.0
next prev parent reply other threads:[~2023-11-01 10:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-01 10:14 [bug#66876] [WIP PATCH 0/1] gnu: home: services: Add home-pipewire Sughosha via Guix-patches via
2023-11-01 10:14 ` Sughosha via Guix-patches via [this message]
2023-11-01 18:33 ` [bug#66877] [WIP PATCH 1/1] " chris
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=d2c4964c80599cc20fd981dc76827e52d45d40ea.1698833388.git.sughosha@disroot.org \
--to=guix-patches@gnu.org \
--cc=66877@debbugs.gnu.org \
--cc=sughosha@disroot.org \
--cc=sughosha@proton.me \
/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).