From 7ec1b28c13e859f47a73ef8293940247d94c2399 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Fri, 8 Jul 2022 14:18:10 +0200 Subject: [PATCH] audio: switch to wireplumber for pipewire configuration https://nixos.wiki/wiki/PipeWire#Bluetooth_Configuration --- modules/audio/default.nix | 34 +++++++++++----------------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/modules/audio/default.nix b/modules/audio/default.nix index 6d1c9617..6b4924a6 100644 --- a/modules/audio/default.nix +++ b/modules/audio/default.nix @@ -43,31 +43,19 @@ in }; }; config.pipewire-pulse = builtins.fromJSON (builtins.readFile ./pipewire-pulse.conf.json); + }; - # Bluetooth configuration for pipewire - media-session.config.bluez-monitor.rules = mkIf cfg.bluetooth.enable [ - { - # Matches all cards - matches = [{ "device.name" = "~bluez_card.*"; }]; - actions = { - "update-props" = { - "bluez5.reconnect-profiles" = [ "hfp_hf" "hsp_hs" "a2dp_sink" ]; - # mSBC is not expected to work on all headset + adapter combinations. - "bluez5.msbc-support" = true; - # SBC-XQ is not expected to work on all headset + adapter combinations. - "bluez5.sbc-xq-support" = true; - }; - }; + # Bluetooth configuration using wireplumber + # https://nixos.wiki/wiki/PipeWire#Bluetooth_Configuration + environment.etc = { + "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 ]" } - { - matches = [ - # Matches all sources - { "node.name" = "~bluez_input.*"; } - # Matches all outputs - { "node.name" = "~bluez_output.*"; } - ]; - } - ]; + ''; }; # Enable bluetooth