From 1bc5fe7ea5cd834f77a01f9e369183d93933508a Mon Sep 17 00:00:00 2001
From: j1nx
Date: Thu, 31 Aug 2023 13:33:35 +0000
Subject: [PATCH] [ALL] Pass the pipewire sockets into the containers instead
of pulseaudio
---
.../etc/containers/systemd/users/ovos_audio.container | 7 ++++---
.../etc/containers/systemd/users/ovos_core.container | 6 ++++--
.../etc/containers/systemd/users/ovos_listener.container | 6 ++++--
.../etc/containers/systemd/users/ovos_phal.container | 6 ++++--
4 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_audio.container b/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_audio.container
index effa784c..960913c7 100644
--- a/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_audio.container
+++ b/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_audio.container
@@ -1,6 +1,8 @@
[Unit]
Description=OpenVoiceOS Audio Service
After=local-fs.target
+Wants=pipewire.service
+After=pipewire.service
Wants=ovos_messagebus.service
After=ovos_messagebus.service
Wants=ovos_phal.service
@@ -15,12 +17,11 @@ HostName=ovos_audio
Network=host
Timezone=local
UserNS=keep-id:uid=%U,gid=%G
-Environment=PULSE_SERVER=unix:/run/user/1000/pulse/native
-Environment=DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
+EnvironmentHost=true
AddDevice=/dev/snd
Volume=%h/ovos/config:/home/ovos/.config/mycroft
Volume=%h/ovos/tmp:/tmp/mycroft
-Volume=%t/pulse:/run/user/1000/pulse:ro
+Volume=%t/pipewire-0:/run/user/1000/pipewire-0:ro
Volume=%t/bus:/run/user/1000/bus:ro
Volume=ovos_tts_cache:/home/ovos/.cache/mycroft
diff --git a/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_core.container b/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_core.container
index 9becc5c9..73047bc1 100644
--- a/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_core.container
+++ b/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_core.container
@@ -1,6 +1,8 @@
[Unit]
Description=OpenVoiceOS Core Service
After=local-fs.target
+Wants=pipewire.service
+After=pipewire.service
Wants=ovos_messagebus.service
After=ovos_messagebus.service
Wants=ovos_phal.service
@@ -15,11 +17,11 @@ HostName=ovos_core
Network=host
Timezone=local
UserNS=keep-id:uid=%U,gid=%G
-Environment=PULSE_SERVER=unix:/run/user/1000/pulse/native
+EnvironmentHost=true
AddDevice=/dev/snd
Volume=%h/ovos/config:/home/ovos/.config/mycroft
Volume=%h/ovos/tmp:/tmp/mycroft
-Volume=%t/pulse:/run/user/1000/pulse:ro
+Volume=%t/pipewire-0:/run/user/1000/pipewire-0:ro
Volume=ovos_nltk:/home/ovos/nltk_data
Volume=%h/ovos/share:/home/ovos/.local/share/mycroft
diff --git a/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_listener.container b/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_listener.container
index 72a2ddfa..0535ea01 100644
--- a/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_listener.container
+++ b/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_listener.container
@@ -1,6 +1,8 @@
[Unit]
Description=OpenVoiceOS Dinkum Listener Service
After=local-fs.target
+Wants=pipewire.service
+After=pipewire.service
Wants=ovos_messagebus.service
After=ovos_messagebus.service
Wants=ovos_phal.service
@@ -15,11 +17,11 @@ HostName=ovos_listener
Network=host
Timezone=local
UserNS=keep-id:uid=%U,gid=%G
-Environment=PULSE_SERVER=unix:/run/user/1000/pulse/native
+EnvironmentHost=true
AddDevice=/dev/snd
Volume=%h/ovos/config:/home/ovos/.config/mycroft:ro
Volume=%h/ovos/tmp:/tmp/mycroft
-Volume=%t/pulse:/run/user/1000/pulse:ro
+Volume=%t/pipewire-0:/run/user/1000/pipewire-0:ro
Volume=ovos_listener_records:/home/ovos/.local/share/mycroft/listener
Volume=ovos_models:/home/ovos/.local/share/precise-lite
Volume=ovos_vosk:/home/ovos/.local/share/vosk
diff --git a/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_phal.container b/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_phal.container
index fd11a672..0c253227 100644
--- a/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_phal.container
+++ b/buildroot-external/rootfs-overlay/etc/containers/systemd/users/ovos_phal.container
@@ -1,6 +1,8 @@
[Unit]
Description=OpenVoiceOS PHAL Service
After=local-fs.target
+Wants=pipewire.service
+After=pipewire.service
Wants=ovos_messagebus.service
After=ovos_messagebus.service
@@ -13,11 +15,11 @@ HostName=ovos_phal
Network=host
Timezone=local
UserNS=keep-id:uid=%U,gid=%G
-Environment=PULSE_SERVER=unix:/run/user/1000/pulse/native
+EnvironmentHost=true
AddDevice=/dev/snd
Volume=%h/ovos/config:/home/ovos/.config/mycroft
Volume=%h/ovos/tmp:/tmp/mycroft
-Volume=%t/pulse:/run/user/1000/pulse:ro
+Volume=%t/pipewire-0:/run/user/1000/pipewire-0:ro
[Service]
TimeoutStartSec=900