This repository has no description
1.6 kB
52 lines
1{ pkgs, ... }:
2{
3 security.rtkit.enable = true;
4
5 hardware.bluetooth = {
6 enable = true;
7 powerOnBoot = true;
8 };
9
10 environment.systemPackages = with pkgs; [
11 alsa-utils
12 pulseaudio
13 ponymix
14 bluetuith
15 ];
16
17 users.users.mainUser.extraGroups = [
18 "bluetooth"
19 "pipewire"
20 ];
21
22 services.pipewire = {
23 enable = true;
24 systemWide = true;
25 alsa.enable = true;
26 alsa.support32Bit = true;
27 pulse.enable = true;
28 jack.enable = true;
29 };
30
31 # WirePlumber's bluez monitor calls node:activate() on the result of
32 # LocalNode(), which is nil when the adapter factory refuses the node. The
33 # WH-1000XM5 triggers that whenever its audio transport dies ("spa.bluez5:
34 # Failure in Bluetooth audio transport", then "mod.adapter: can't get
35 # format: Invalid argument"): the Lua hook throws, its AsyncEventHook
36 # transition never completes, and the event dispatcher stalls for good --
37 # after which no node ever activates again, the ALSA sinks sit in SUSPENDED,
38 # and every player blocks until
39 # wireplumber is restarted by hand. Fail the transition instead.
40 services.pipewire.wireplumber.package = pkgs.wireplumber.overrideAttrs (old: {
41 postPatch = (old.postPatch or "") + ''
42 substituteInPlace src/scripts/monitors/bluez/create-node.lua \
43 --replace-fail \
44 'local node = LocalNode("adapter", properties)' \
45 'local node = LocalNode("adapter", properties)
46 if node == nil then
47 transition:return_error ("Failed to create BT node " .. tostring (properties["node.name"]))
48 return
49 end'
50 '';
51 });
52}