feat: availability broadcast (Kind 30078) + WiFi auto-connect

Wire up the availability broadcast composable to publish the ATM's
status as a replaceable Kind 30078 Nostr event. Publishes on
availability change (debounced) and as a 5-minute heartbeat so
monitors can detect offline machines.

Also adds WiFi auto-connect for BATM3: reads SSID/PSK from
/var/lib/lamassu-atm/wifi.conf at boot. Credentials stay local.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Patrick Mulligan 2026-03-29 22:36:58 -04:00
commit 67c7c12ade
3 changed files with 82 additions and 1 deletions

View file

@ -68,6 +68,43 @@
hybrid-sleep.enable = false;
};
# WiFi: read credentials from /var/lib/lamassu-atm/wifi.conf (not in repo)
# Format: SSID=MyNetwork\nPSK=MyPassword
system.activationScripts.wifi-setup = ''
WIFI_CONF="/var/lib/lamassu-atm/wifi.conf"
if [ -f "$WIFI_CONF" ]; then
SSID=$(grep '^SSID=' "$WIFI_CONF" | cut -d= -f2-)
PSK=$(grep '^PSK=' "$WIFI_CONF" | cut -d= -f2-)
if [ -n "$SSID" ] && [ -n "$PSK" ]; then
CONN_FILE="/etc/NetworkManager/system-connections/$SSID.nmconnection"
if [ ! -f "$CONN_FILE" ]; then
cat > "$CONN_FILE" << EOF
[connection]
id=$SSID
type=wifi
autoconnect=true
[wifi]
mode=infrastructure
ssid=$SSID
[wifi-security]
key-mgmt=wpa-psk
psk=$PSK
[ipv4]
method=auto
[ipv6]
method=auto
EOF
chmod 600 "$CONN_FILE"
echo "[WiFi] Created connection for $SSID"
fi
fi
fi
'';
# eGalax touchscreen (Dell 9030 AIO built-in panel)
# The eGalax HID descriptor confuses libinput (treats it as touchpad).
# Fix: unbind from usbhid at boot, bind to usbtouchscreen kernel module,