The box within reach of the couch: a Raspberry Pi 3B with the AIY Voice HAT, from the first household's configuration, made generic. - box/body: the button service, in Python: press and talk, turns by voice, a press interrupts; the look signal - box/*.js: the ir and look capabilities, behind gates, for the brain; the ask client, the box's side of a conversation - box/module.nix: the services, each confined to the devices and addresses it needs; the private network as an option (a tailnet by default); the Pico found by its USB IDs, as /dev/pdtv26-ir - box/voicehat.nix: the Voice HAT's device tree overlay and ALSA setup - lib.mkBox: a box's whole system from its name, the home server's, the Wi-Fi network's, and who looks after it - checks: box-js, box-py (doctests and pyflakes), and box-system (an example box's system evaluates) Generated-by: Claude Opus 5.5
1.5 KiB
Contributing to pdtv26
The README says what pdtv26 does and why; this is how to work on it.
Development
The tools come from the flake. To run every folder's tests, as CI should on each push:
nix flake check
To work in one folder:
cd ir-pico
nix develop
make help
make test
Each module's docstring says what it is. Docs are only for what isn't code, such as wiring.
Design
Capabilities on the wire
The connections are Cap'n Web over WebSockets, on a private network such as a Tailscale tailnet. A server listens with a gate, not the capability itself: the gate hands the capability to whoever presents its key, compared in constant time, and a client can open and call in one round trip. Keys reach services through systemd's LoadCredential ($CREDENTIALS_DIRECTORY), never through argv, the environment, or the Nix store.
Confinement
The box's services run under systemd with ProtectSystem=strict, DynamicUser where possible, DevicePolicy=closed and only the devices they need (the GPIO chip and ALSA for the button; the Pico's tty for ir), and IPAddressAllow limited to the private network, plus the camera's LAN for look alone. look won't take a frame unless the button service is there to show it: it connects to the button's socket, whose group is look's alone, and waits for the box to flash and tap. box/module.nix has the details.