diff --git a/hw/straylight/default.nix b/hw/straylight/default.nix index 8330a3b..38d643a 100644 --- a/hw/straylight/default.nix +++ b/hw/straylight/default.nix @@ -200,6 +200,30 @@ in }; }; + # TLS for the llama.cpp API over the tailnet. Clients using + # https://straylight.scylla-hammerhead.ts.net/v1 hit Tailscale Serve on + # :443, which proxies to llama-server on localhost:11434. A boot oneshot + # is not enough: `tailscale serve reset` clears the config without + # stopping this unit, so a timer re-applies it. + systemd.services.tailscale-serve-llama = { + description = "Tailscale HTTPS proxy for llama-server"; + after = [ "tailscaled.service" "llama-server.service" ]; + wants = [ "tailscaled.service" ]; + serviceConfig = { + Type = "oneshot"; + ExecStart = "${pkgs.tailscale}/bin/tailscale serve --bg --https=443 http://127.0.0.1:11434"; + }; + }; + systemd.timers.tailscale-serve-llama = { + description = "Re-apply Tailscale HTTPS proxy for llama-server"; + wantedBy = [ "timers.target" ]; + timerConfig = { + OnBootSec = "15s"; + OnUnitActiveSec = "1min"; + Unit = "tailscale-serve-llama.service"; + }; + }; + # Local ASR: OpenAI-compatible /v1/audio/transcriptions on 11435. # CPU-only so it does not contend with llama-server for GTT. users.users.whisper-server = {