PipeWire: Difference between revisions

Koalp (talk | contribs)
m fix missing letters
Yajo (talk | contribs)
Lua is no longer used.
Line 29: Line 29:
PipeWire can be configured to use specific codecs. The mSBC codec provides slightly better sound quality in calls than regular HFP/HSP, while the SBC-XQ provides better sound quality for audio listening. For more information [https://www.guyrutenberg.com/2021/03/11/replacing-pulseaudio-with-pipewire/ see this link].
PipeWire can be configured to use specific codecs. The mSBC codec provides slightly better sound quality in calls than regular HFP/HSP, while the SBC-XQ provides better sound quality for audio listening. For more information [https://www.guyrutenberg.com/2021/03/11/replacing-pulseaudio-with-pipewire/ see this link].


Wireplumber (<code>services.pipewire.wireplumber</code>) is the default modular session / policy manager for PipeWire in unstable, however there is currently no way to configure the advanced settings using the module. However, with 24.05 you can use <code>services.pipewire.wireplumber.configPackages</code> to create drop-in Lua files directly in the expected path (<code>/etc/wireplumber/bluetooth.lua.d</code>). For example:
Wireplumber (<code>services.pipewire.wireplumber</code>) is the default modular session / policy manager for PipeWire in unstable. To add custom configuration in NixOS 24.05 you can use <code>services.pipewire.wireplumber.extraConfig</code> directly. For example:


<syntaxHighlight lang=nix>
<syntaxhighlight lang="nix">
services.pipewire.wireplumber.extraConfig."10-bluez.conf" = {
"monitor.bluez.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"];
};
};
</syntaxhighlight>
 
Alternatively you can set <code>services.pipewire.wireplumber.configPackages</code> as well, adding derivations that output wireplumber config files in <code>$out/share/wireplumber/wireplumber.conf.d/*.conf</code>:
 
<syntaxhighlight lang="nix">
services.pipewire.wireplumber.configPackages = [
services.pipewire.wireplumber.configPackages = [
(pkgs.writeTextDir "share/wireplumber/bluetooth.lua.d/51-bluez-config.lua" ''
(pkgs.writeTextDir "share/wireplumber/wireplumber.conf.d/10-bluez.conf" ''
bluez_monitor.properties = {
monitor.bluez.properties = {
["bluez5.enable-sbc-xq"] = true,
bluez5.enable-sbc-xq = true
["bluez5.enable-msbc"] = true,
bluez5.enable-msbc = true
["bluez5.enable-hw-volume"] = true,
bluez5.enable-hw-volume = true
["bluez5.headset-roles"] = "[ hsp_hs hsp_ag hfp_hf hfp_ag ]"
bluez5.headset-roles = [hsp_hs hsp_ag hfp_hf hfp_ag]
}
}
'')
'')
];
];
</syntaxHighlight>
</syntaxhighlight>
 
Alternatively you can set <code>services.pipewire.wireplumber.extraLuaConfig</code> as well:
 
<syntaxHighlight lang=nix>
services.pipewire.wireplumber.extraLuaConfig.bluetooth."51-bluez-config" = ''
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 ]"
}
'';
</syntaxHighlight>


It is possible change a particular user instead of system-wide, with adding this to <code>~/.config/wireplumber/bluetooth.lua.d</code> instead, manually or using Home-Manager.
It is possible change a particular user instead of system-wide, with adding this to <code>~/.config/wireplumber/bluetooth.lua.d</code> instead, manually or using Home-Manager.