Commit 7bd701ec0190

Vincent Demeester <vincent@sbr.pm>
2024-03-04 15:57:32
audio: update pipewire and wireplumber configurations
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent be92cc8
Changed files (1)
systems
modules
hardware
systems/modules/hardware/audio.nix
@@ -36,38 +36,37 @@ in
         alsa.enable = true;
         alsa.support32Bit = true;
         pulse.enable = true;
-        wireplumber.enable = true;
+        wireplumber = {
+          enable = true;
+          configPackages = [
+            (pkgs.writeTextDir "share/wireplumber/bluetooth.lua.d/51-bluez-config.lua" ''
+              bluez_monitor.properties = {
+                ["bluez5.enable-sbc-xq"] = true,
+                ["bluez5.enable-msbc"] = true,
+                ["bluez5.enable-hw-volume"] = true,
+                ["bluez5.headset-roles"] = "[ hsp_hs hsp_ag hfp_hf hfp_ag ]"
+              }
+            '')
+          ];
+        };
+        extraConfig = {
+          pipewire-pulse = {
+            "50-network-party.conf" = {
+              "context.modules" = [
+                { name = "libpipewire-module-protocol-native"; }
+                { name = "libpipewire-module-client-node"; }
+                { name = "libpipewire-module-adapter"; }
+                { name = "libpipewire-module-metadata"; }
+              ];
+              "context.exec" = [
+                { path = "pactl"; args = "load-module module-native-protocol-tcp"; }
+                { path = "pactl"; args = "load-module module-zeroconf-discover"; }
+                { path = "pactl"; args = "load-module module-zeroconf-publish"; }
+              ];
+            };
+          };
+        };
       };
-      environment.etc = {
-        # "pipewire/pipewire.conf.d/session-manager.conf".text = ''
-        #   context.modules = [
-        #      { name = libpipewire-module-session-manager }
-        #      { name = libpipewire-module-client-device }
-        #   ]
-        # '';
-        "pipewire/pipewire-pulse.conf.d/50-network-party.conf".text = ''
-          context.exec = [
-              { path = "pactl" args = "load-module module-native-protocol-tcp" }
-              { path = "pactl" args = "load-module module-zeroconf-discover" }
-              { path = "pactl" args = "load-module module-zeroconf-publish" }
-          ]
-        '';
-        "wireplumber/bluetooth.lua.d/51-bluez-config.lua".text = ''
-          bluez_monitor.properties = {
-            ["bluez5.enable-sbc-xq"] = true,
-            ["bluez5.enable-msbc"] = true,
-            ["bluez5.enable-hw-volume"] = true,
-            ["bluez5.headset-roles"] = "[ hsp_hs hsp_ag hfp_hf hfp_ag ]"
-          }
-        '';
-      };
-      /*
-        wireplumber.profiles = {
-        main = {
-        monitor.alsa = required
-        }
-        }
-      */
       networking.firewall = {
         allowedTCPPorts = [ 6001 6002 ];
       };