all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#66876] [WIP PATCH 0/1] gnu: home: services: Add home-pipewire.
@ 2023-11-01 10:14 Sughosha via Guix-patches via
  2023-11-01 10:14 ` [bug#66877] [WIP PATCH 1/1] " Sughosha via Guix-patches via
  0 siblings, 1 reply; 3+ messages in thread
From: Sughosha via Guix-patches via @ 2023-11-01 10:14 UTC (permalink / raw)
  To: 66876; +Cc: Sughosha

This service works fine in my local machine. I don't know much about services
and their documentations. If someone can work on this, it would be great.

Sughosha (1):
  gnu: home: services: Add home-pipewire.

 gnu/home/services/sound.scm | 90 ++++++++++++++++++++++++++++++++++++-
 1 file changed, 89 insertions(+), 1 deletion(-)


base-commit: c0895371c5759c7d9edb330774e90f192cc4cf2c
-- 
2.41.0





^ permalink raw reply	[flat|nested] 3+ messages in thread

* [bug#66877] [WIP PATCH 1/1] gnu: home: services: Add home-pipewire.
  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
  2023-11-01 18:33   ` chris
  0 siblings, 1 reply; 3+ messages in thread
From: Sughosha via Guix-patches via @ 2023-11-01 10:14 UTC (permalink / raw)
  To: 66877; +Cc: Sughosha

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





^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [bug#66877] [WIP PATCH 1/1] gnu: home: services: Add home-pipewire.
  2023-11-01 10:14 ` [bug#66877] [WIP PATCH 1/1] " Sughosha via Guix-patches via
@ 2023-11-01 18:33   ` chris
  0 siblings, 0 replies; 3+ messages in thread
From: chris @ 2023-11-01 18:33 UTC (permalink / raw)
  To: 66877; +Cc: chris

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 &))
```




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-11-01 18:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [bug#66877] [WIP PATCH 1/1] " Sughosha via Guix-patches via
2023-11-01 18:33   ` chris

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.