feat: install on any Linux with Nix and systemd
check / check (push) Canceled after 0s

Not just the first household's machines: a home server of your own
runs speech, the status page, and the brain, and a household flake of
your own makes the box, from a few names.

- speech: sudo make install: the server, its models, its key, and its
  systemd unit, answering only the private network
- box: make keys, from the home server: each connection's key piped
  to both its ends, never on disk but where it's used
- docs/setup.md: the setup guide, from the household repository to
  teaching it the remotes
- README: the home server; Make your own

Generated-by: Claude Opus 5.5
This commit is contained in:
dckc committed 2026-12-02 18:57:21 -06:00
1 parent 9b85deca8f
commit f3f2c8966e
5 files changed
+179 -2

No files matched your search

+43 -1
View File
@@ -1,5 +1,6 @@
# speech: the agent's ears and voice, as a capability over Cap'n Web.
# Tools come from the flake: nix develop --command make test
# sudo make install # on the home server: the server, its models, its key, and its unit
WHISPER = https://huggingface.co/ggerganov/whisper.cpp/resolve/main
MODEL = cache/ggml-base.en.bin
@@ -8,8 +9,15 @@ VOICE = cache/en_US-danny-low.onnx
PORT = 18024
PHRASE = Put on the ballgame.
UA = pdtv26-speech-setup (curl)
FLAKE = ..
# Where it listens, and the private network's addresses: the only ones it answers. A tailnet's, by default.
SERVE_PORT = 8024
RANGES = 100.64.0.0/10 fd7a:115c:a1e0::/48
LIB = /var/lib/pdtv26-speech
ETC = /etc/pdtv26-speech
UNIT = /etc/systemd/system/pdtv26-speech.service
.PHONY: help test smoke
.PHONY: help test smoke app install
.DELETE_ON_ERROR:
## list targets
@@ -37,3 +45,37 @@ cache/en_US-danny-low.%:
## a round trip through a real server: speak PHRASE, hear it back, compare
smoke: cache/speech $(MODEL) $(VOICE) $(VOICE).json
./smoke.sh cache/speech/bin $(MODEL) $(VOICE) $(PORT) '$(PHRASE)'
## the server, installed: a GC root in LIB
app:
install -d $(LIB)
nix build --out-link $(LIB)/app '$(FLAKE)#speech'
$(LIB)/models/%:
install -d -m 755 $(dir $@)
curl -fsSL -A '$(UA)' -o $@ $(WHISPER)/$*
chmod 644 $@
$(LIB)/voices/en_US-danny-low.%:
install -d -m 755 $(dir $@)
curl -fsSL -A '$(UA)' -o $@ $(VOICES)/$(notdir $@)
chmod 644 $@
## the key the box presents: 160 random bits, root's alone; systemd hands the service a copy
$(ETC)/speech-key:
install -d -m 700 $(dir $@)
umask 077; head -c 20 /dev/urandom | base32 | tr A-Z a-z | tr -d = > $@
$(ETC)/settings: Makefile
install -d -m 700 $(dir $@)
printf 'PORT=%s\nMODEL=%s\nVOICE=%s\n' $(SERVE_PORT) $(notdir $(MODEL)) $(basename $(notdir $(VOICE))) > $@
$(UNIT): pdtv26-speech.service Makefile
sed 's|@ranges@|$(RANGES)|' $< > $@
## build, fetch the models, make the key if there's none, install the unit, and (re)start it
install: app $(LIB)/models/$(notdir $(MODEL)) $(LIB)/voices/$(notdir $(VOICE)) $(LIB)/voices/$(notdir $(VOICE)).json $(ETC)/speech-key $(ETC)/settings $(UNIT)
systemctl daemon-reload
systemctl enable pdtv26-speech
systemctl restart pdtv26-speech
sleep 2; systemctl --no-pager status pdtv26-speech | grep -E '●|Active|listening'
+27
View File
@@ -0,0 +1,27 @@
[Unit]
Description=pdtv26-speech: the agent's ears and voice, a capability over Cap'n Web on the private network
After=network-online.target
Wants=network-online.target
[Service]
# Listens on every address, but the kernel lets only the private network and loopback in or out.
EnvironmentFile=/etc/pdtv26-speech/settings
ExecStart=/var/lib/pdtv26-speech/app/bin/speech-server :: ${PORT} /var/lib/pdtv26-speech/models/${MODEL} /var/lib/pdtv26-speech/voices/${VOICE}.onnx
DynamicUser=yes
LoadCredential=speech-key:/etc/pdtv26-speech/speech-key
IPAddressDeny=any
IPAddressAllow=localhost @ranges@
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
NoNewPrivileges=yes
ProtectSystem=strict
ProtectHome=yes
PrivateTmp=yes
PrivateDevices=yes
# whisper uses every core it can; whatever else the home server does comes first.
Nice=10
MemoryMax=10G
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target