Dual boot bluetooth pairing

In other distros I can do as described in the arch wiki to use bluetooth devices without re-pairing them when I change OS. Basically I need to manually write a key in /var/lib/bluetooth/[BT-Adapter-MAC-address]/[device-MAC-address].

Assuming I already have a pairing key and already know the mac addresses of my adapter and devices, how do I do this in NixOS?

I’m encountering a similar issue, if anyone has an idea about how to do this we’d appreciate.

You can literally just … do that?

Either manually (the same as if pairing via a UI); when I reinstalled a machine I just rsynced these files from the old version to keep the original device pairings (and the same for the wifi connections made via networkmanager’s gnome UI)

Or using nix to create the files, with something like agenix to protect the secret content.