Got some Bluetooth headphones/earbuds that work without issue on Android and Windows, but I’m not having much luck getting them working in NixOS.
I can see the device appear in Blueman, and a connection attempt can be made, but it says “Connected” for a couple of seconds at most before disconnecting, and it goes around a loop of Connecting/Disconnecting for a few times before stopping.
When trying to connect using bluetoothctl, I get the following (N.B. In the text below “” is being used to replace the real device ID value that is shown in the terminal output):
[bluetooth]# [CHG] Device <deviceid> Connected: yes
[Epic Air Sport ANC]# Failed to connect: org.bluez.Error.Failed br-connection-canceled
[Epic Air Sport ANC]# [CHG] Device <deviceid> Connected: no
I read that the issue may be with authentication, so I tried using “sudo hciconfig noauth”, but this didn’t seem to alter the behaviour.
Any advice on how best to troubleshoot this?
In case it matters, here’s the audio/bluetooth settings from my configuration.nix file, I’m not 100% sure if these settings are correct:
# Enable sound with pipewire.
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# If you want to use JACK applications, uncomment this
#jack.enable = true;
# use the example session manager (no others are packaged yet so this is enabled by default,
# no need to redefine it in your config for now)
#media-session.enable = true;
};
# Bluetooth settings
services.pipewire.wireplumber.extraConfig."10-bluez" = {
"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"
];
};
};
hardware.bluetooth = {
enable = true;
powerOnBoot = true;
settings = {
General = {
Name = "Computer";
ControllerMode = "dual";
FastConnectable = "true";
Experimental = "true";
};
Policy = { AutoEnable = "true"; };
LE = { EnableAdvMonInterleaveScan = "true"; };
};
};
services.blueman.enable = true;