Files
homelab/hosts/terra/configuration.nix
T
darmanandClaude Opus 5.5 efb690206b feat(terra): luna speaks with ElevenLabs v4 turbo
eleven_v4_turbo is the new default, same price per character as
v3_conversational. v4 also streams over Text to Dialogue, so the switch is
now uses_dialogue() for both. Audio tags may carry free-text directions
("[whispers, in a German accent]"): commas and apostrophes allowed, up to
80 chars. The voice prompt and luna-soul.md teach her the wider tag set,
including in text_to_speech voice notes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 00:01:48 +02:00

200 lines
8.8 KiB
Nix

# ---- TERRA ----
{ config, pkgs, lib, inputs, ... }:
let
unstable = import inputs.nixpkgs-unstable {
inherit (pkgs.stdenv.hostPlatform) system;
config = pkgs.config;
};
in
{
imports = [
./hardware-configuration.nix
./disk-config.nix
./secrets.nix
../../common.nix
../../services/containers.nix
../../services/vpn/tailscale.nix
../../services/monitoring/node-exporter.nix
../../services/desktop/desktop-hyprland.nix
../../services/desktop/desktop-apps.nix
../../services/desktop/claude-desktop.nix
../../services/desktop/librechat.nix
../../services/desktop/luna-voice.nix
../../services/dev/turtle-beach-re.nix
inputs.turtle-beach-swarm-re.nixosModules.release
inputs.tbctl.nixosModules.tbctl
];
# Swarm leaves the KB7 in host control after a warm reboot from Windows.
services.turtle-beach-release.enable = true;
# tbctl CLI + GUI + tbd daemon/agent for the KB7/KP7/Kone II Air.
services.tbctl = {
enable = true;
users = [ "darman" ];
gui.enable = true;
daemon.enable = true;
agent.enable = true;
};
# Talk to luna (Hermes Agent on mars) with SUPER+V — see
# hosts/terra/home/hyprland.nix for the push-to-talk binds.
homelab.lunaVoice = {
enable = true;
hermesKeyFile = config.sops.secrets.hermes_api_server_key.path;
elevenLabsKeyFile = config.sops.secrets.elevenlabs_api_key.path;
# luna's own voice — must stay in sync with `tts.elevenlabs.voice_id` in
# her config.yaml on mars, or she sounds like someone else on the desktop
# than she does on Telegram.
voiceId = "LZAcK8Cx5QjdQhfBsJQZ";
# Her voice manners live here, not in SOUL.md: only this client sends
# [voice], and it keeps them out of every Telegram prompt.
systemPrompt = ''
You are speaking through luna-voiced, your voice on terra, which reaches
you over the Hermes API on mars. Messages beginning with [voice] come from
darman's desktop microphone, and your reply is read aloud by ElevenLabs v4,
which performs audio tags instead of reading them. Captions hide the tags.
Audio tags:
- Use them only on [voice] messages and in text_to_speech scripts. Anywhere else (Telegram text, the dashboard) they show up as literal text.
- One to four per reply, and only when it fits the moment. A tag in every sentence stops sounding natural.
- Put the tag right before the words it colours: "[sighs] Fine, I'll reboot jupiter." A tag on its own ("[laughs]") works as a reaction.
- Short tags: [laughs], [chuckles], [sighs], [exhales], [yawns], [whispers], [excited], [curious], [sarcastic], [mischievously], [clears throat], [pause], [long pause].
- Free-text directions work too, under about ten words: [dryly, like a newsreader], [muttering in a native German accent], [gently, a little tender], [suddenly alert].
- Sound effects set a scene: [phone buzzing], [keyboard clacking]. Use them rarely.
- Inside a tag: lowercase letters, spaces, hyphens, commas and apostrophes only, at most 80 characters. Anything else ([1], [link](url), [!!], a period) breaks the tag and it gets read aloud.
- German works fine mid-sentence ("Na gut", "Ach du meine Güte"). For a proper German accent on it, direct it: "[in a native German accent] Ach du meine Güte."
- Every character is billed, tags included, so keep spoken replies short.
What never lands in a spoken reply. Before speech, everything except
letters, digits and . , ! ? ; : ' " is turned into a space. Anything you'd
show with symbols has to be said in words.
- No kaomoji or emoji: (¬‿¬), ^^, :3, 🎉 vanish or leave a stray pause. Put the mood into words or an audio tag instead.
- No markdown: asterisks, backticks, headings, bullet lists, tables and code blocks are dropped, so a list comes out as one run-on sentence. Say "first", "then", "and finally" instead.
- Symbols carry no meaning once spoken. 50% becomes "50", 20°C becomes "20 C", A & B becomes "A B", and +, $, €, @, #, ~ and / are all dropped. Write "50 percent", "20 degrees", "and", "euros", "at".
- Parentheses are removed without a pause, so the aside runs into the sentence. Use commas instead.
- An em dash becomes a comma pause. A hyphen becomes a space, which is fine for "push-to-talk".
- URLs, file paths, hashes, IPs and commands are unreadable aloud ("nix store q2s2p…"). Describe them ("the terra system build", "jupiter's data disk") and offer to send the exact text on Telegram.
- No <think> blocks or stage directions like *grins*. The reasoning is never spoken, and the asterisks are stripped so "grins" would be read out. Use [laughs] or [mischievously] instead.
- Keep it to one or two sentences unless asked for detail. Long answers are tiring to listen to, and every character is billed.
'';
};
networking.hostName = "terra";
homelab.greeter = {
monitors = config.home-manager.users.darman.wayland.windowManager.hyprland.settings.monitor;
primaryOutput = "DP-2";
defaultUser = "darman";
keyboardLayout = "de";
};
services.flatpak = {
enable = true;
remotes = [{ name = "flathub"; location = "https://dl.flathub.org/repo/flathub.flatpakrepo"; }];
packages = [
{ appId = "com.github.tchx84.Flatseal"; origin = "flathub"; }
{ appId = "com.blitzfc.qbz"; origin = "flathub"; }
{ appId = "com.discordapp.Discord"; origin = "flathub"; }
{ appId = "org.telegram.desktop"; origin = "flathub"; }
{ appId = "com.bambulab.BambuStudio"; origin = "flathub"; }
{ appId = "md.obsidian.Obsidian"; origin = "flathub"; }
];
};
environment.systemPackages = [ unstable.proton-pass-cli ];
# run0 waits on systemd over D-Bus, whose 25s default call timeout runs out
# while the polkit dialog is still open (slow typing, a vault lookup).
# Scoped to run0 so a hung systemctl doesn't also wait 5min.
programs.zsh.shellAliases.run0 = "SYSTEMD_BUS_TIMEOUT=5min run0";
# ---- nix-ld: lets generic dynamically-linked Linux binaries run as-is —
# needed for editor extensions (Zed/VSCode LSPs, debuggers, etc.) that
# download prebuilt binaries not built for NixOS. See
# https://nix.dev/permalink/stub-ld ----
programs.nix-ld.enable = true;
# JetBrains IDEs installed via Toolbox bundle a JBR that aborts with
# `libX11.so.6: cannot open shared object file` under the default (X11-less)
# nix-ld set. Additive — merges with the module's own base list (zlib etc).
programs.nix-ld.libraries = with pkgs; [
freetype
fontconfig
libGL
libxkbcommon
wayland
libsecret
libx11
libxext
libxi
libxrender
libxtst
libxcursor
libxrandr
libxinerama
libxcb
icu
];
# NixOS only ships /bin/sh; envfs serves /bin and /usr/bin from PATH so
# third-party scripts hardcoding `#!/bin/bash` (e.g. JetBrains Toolbox's
# generated launchers) still resolve.
services.envfs.enable = true;
# ---- home-manager (user-level config for darman) ----
# Base settings + shared zsh baseline live in common.nix + home/common.nix
# (every host); this layers terra's desktop profile on top (imports merge).
home-manager.extraSpecialArgs = { inherit unstable inputs; };
home-manager.users.darman.imports = [ ./home.nix ];
# ---- Boot (UEFI) ----
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
hardware.cpu.amd.updateMicrocode = true;
# Lets `nix build` target mercury (aarch64) from here — see CLAUDE.md's
# aarch64 gotcha.
boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
# ---- GPU (Radeon RX 6800 XT / Navi 21) ----
hardware.enableRedistributableFirmware = true;
boot.initrd.kernelModules = [ "amdgpu" ];
# /dev/dri/renderD128 is root:render 0660 — host user needs render group for
# rootless podman GPU containers (Vulkan whisper.cpp/llama.cpp).
users.users.darman.extraGroups = [ "render" "video" ];
# ---- Dev-data disks — NOT in disko, mounted read-write, never wiped ----
fileSystems."/mnt/hdd_01" = {
device = "/dev/disk/by-uuid/b8445126-ec6d-4f88-818a-d9e13031d9a4";
fsType = "ext4";
options = [ "nofail" ];
};
fileSystems."/mnt/ssd_01" = {
device = "/dev/disk/by-uuid/6ca18a9f-27bc-4e58-aea8-de43a0d0ed5d";
fsType = "ext4";
options = [ "nofail" ];
};
# jupiter's samba share (services/network/samba.nix) — mounted on demand so
# terra doesn't stall boot/login when jupiter is off or unreachable.
fileSystems."/mnt/jupiter" = {
device = "//jupiter/data";
fsType = "cifs";
options = [
"credentials=${config.sops.templates."jupiter-smb.credentials".path}"
"uid=1000"
"gid=100"
"nofail"
"x-systemd.automount"
"x-systemd.idle-timeout=60"
"x-systemd.mount-timeout=10s"
"_netdev"
];
};
system.stateVersion = "26.05";
}