GNU bug report logs - #66877
[WIP PATCH 1/1] gnu: home: services: Add home-pipewire.

Previous Next

Package: guix-patches;

Reported by: Sughosha <sughosha <at> disroot.org>

Date: Wed, 1 Nov 2023 10:17:02 UTC

Severity: normal

Tags: patch

Merged with 66876

Done: Sergey Trofimov <sarg <at> sarg.org.ru>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 66877 in the body.
You can then email your comments to 66877 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to , guix-patches <at> gnu.org:
bug#66877; Package guix-patches. (Wed, 01 Nov 2023 10:17:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Sughosha <sughosha <at> disroot.org>:
New bug report received and forwarded. Copy sent to , guix-patches <at> gnu.org. (Wed, 01 Nov 2023 10:17:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Sughosha <sughosha <at> disroot.org>
To: guix-patches <at> gnu.org
Cc: Sughosha <sughosha <at> proton.me>
Subject: [WIP PATCH 1/1] gnu: home: services: Add home-pipewire.
Date: Wed,  1 Nov 2023 11:14:42 +0100
From: Sughosha <sughosha <at> 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 <at> gnu.org>
+;;; Copyright © 2023 Sughosha <sughosha <at> 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))
 
 
 ;;;
@@ -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





Merged 66876 66877. Request was from Sughosha <sughosha <at> disroot.org> to control <at> debbugs.gnu.org. (Wed, 01 Nov 2023 10:20:02 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#66877; Package guix-patches. (Wed, 01 Nov 2023 18:36:02 GMT) Full text and rfc822 format available.

Message #10 received at 66877 <at> debbugs.gnu.org (full text, mbox):

From: chris <chris <at> bumblehead.com>
To: 66877 <at> debbugs.gnu.org
Cc: chris <at> bumblehead.com
Subject: [WIP PATCH 1/1] gnu: home: services: Add home-pipewire.
Date: Wed, 1 Nov 2023 11:33:46 -0700
Hello, I would like to share my experience that using pipewire without dbus on guix is practical: and so, it would be great if the home-pipewire-service could be used without dbus. Having said that, only a minority of people use dbus-free systems so feel free to ignore me and I do not want to block this patch.

In case it is useful, here is pipewire is used sans dbus. Guix home is configured to write the pipewire and three wireplumber config files, as described at this link https://wiki.alpinelinux.org/wiki/PipeWire#Configuration 

.config/pipewire/pipewire.conf
.config/wireplumber/wireplumber.conf
.config/wireplumber/main.lua.d/80-disable-dbus.lua
.config/wireplumber/bluetooth.lua.d/80-disable-logind.lua

When pipewire and wireplumber are installed with those files in place, start pipewire and wireplumber sequentially to get working sound. I use this in my .config/sway/config (possibly this is copy-pasted from unmatched-paren)
```
exec_always killall -wqr "(pipewire|wireplumber)" \
  || sleep 1 && ((pipewire &); sleep 2 && (wireplumber &))
```




bug closed, send any further explanations to 66877 <at> debbugs.gnu.org and Sughosha <sughosha <at> disroot.org> Request was from Sergey Trofimov <sarg <at> sarg.org.ru> to control <at> debbugs.gnu.org. (Fri, 07 Mar 2025 06:50:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 04 Apr 2025 11:24:15 GMT) Full text and rfc822 format available.

This bug report was last modified 75 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.