Bluetooth GATT Server to accept Wifi Credentials
If you're on NixOS, run direnv allow
once in the project's root directory.
From then on, the development environment will be initialized as soon as you
cd
into the project's directory. Alternatively, you can run nix develop
manually. Now you should have the correct version of Rust, pkg-config, etc.
in your environment.
- To run a development version of the project:
cargo run
- To compile a release version of the project for your
x86_64
host machine:
nix build .#wifi-setup
# Alternatively
nix build
- To cross-compile for
aarch64
, i.e. a Raspberry Pi
nix build .#wifi-setup-aarch64
To deploy the project on a Raspberry Pi, you'll need the following items:
- A systemd service (see
systemd/wifi-setup.service
) - Bluetooth packages installed (
bluez
andbluetooth
) - The binary compiled for
aarch64
(see above)
Alternatively, on NixOS you can use the deployment script found in the
flake.nix
. This will build the binary, copy it to your target and create the systemd service there for you.
nix run . -- [email protected]
On the Pi, you can check the logs of the service
# Check status
sudo systemctl status wifi-setup
# Follow logs
journalctl -u wifi-setup -f
In addition, you can check the status of the Bluetooth device and underlying software.
# Open interactive bluetooth repl
sudo bluetoothctl
show
power on # If powered off, turn on the bluetooth device
MIT