Pairing Apple AirPods in NixOS
Background
I had a problem that when trying to pair my AirPods to my X13 Yoga running NixOS 23.05, it would show up in
Gnome’s bluetooth settings panel when I put them in discovery mode, but when I clicked the AirPods in the UI,
the stack would crash and restart. I noticed tim-hilt/nixos had a note about setting the
ControllerMode to bredr and this didn’t work for me at first but I think maybe restarting the bluetooth
stack resolved my issue. askubuntu also suggested bredr.
Fix
If you want to pair AirPods in NixOS you must set the bluetooth mode to bredr.
You can do so by editing your configuration.nix with the following lines:
hardware.bluetooth = {
enable = true;
settings = {
General = {
# temp enable to allow pairing Airpods
ControllerMode = "bredr";
# This is the default
# ControllerMode = "dual";
};
};
};
Rebuild your derivation (sudo nixos-rebuild switch) then restart the bluetooth stack (sudo systemctl restart bluetooth).
Now your bluetooth stack won’t crash when attempting to pair with the AirPods. Once you’ve paired you can
switch the configuration back to dual (the default) and it’ll allow re-pairing in the future.