Nix configs for my machines
  • Python 54.9%
  • Nix 39.1%
  • Shell 6%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Bryan Thompson 26485f0a1b
fix(pi-durable): keep the anchor's gateway HELP line the same on every network
Each anchor wrote its own gateway address into the HELP text of
pi_durable_net_anchor_gateway_present, so the five networks' textfile
metrics disagreed and node_exporter's textfile collector rejected them
(node_textfile_scrape_error 1), exposing only one network's file.

A new test runs the anchor script as each of Studio's networks and
requires every HELP and TYPE line to match.
2026-12-02 10:41:06 -08:00
.agents/skills/verify Update verify skill for the runner's removal 2026-11-17 17:01:48 -08:00
.hermes/plans docs: authorize approved oMLX installation trial 2026-10-19 11:01:47 -07:00
docs fix(hermes-updater): carry the Rex patch and recut matrix-send for v0.22.6 2026-11-02 14:28:04 -08:00
hardware-configs feat(gnarbox): restore NixOS host on fresh hardware 2026-09-29 08:15:27 -07:00
modules fix(pi-durable): keep the anchor's gateway HELP line the same on every network 2026-12-02 10:41:06 -08:00
overlays add zen browser to gnarbox 2026-04-04 12:05:19 -07:00
scripts fix(pi-durable): keep the anchor's gateway HELP line the same on every network 2026-12-02 10:41:06 -08:00
.envrc.example add git fetch to .envrcs 2026-02-13 08:12:11 -08:00
.gitignore Allow AGENTS.md to be tracked in this repo 2026-04-10 11:47:55 -07:00
AGENTS.md Run module tests in a copy; tighten cleanup 2026-11-16 18:15:51 -08:00
flake.lock chore(cli-tools): remove Herdr from all hosts 2026-11-03 13:48:05 -08:00
flake.nix chore(cli-tools): remove Herdr from all hosts 2026-11-03 13:48:05 -08:00
README.md feat(pi-durable): cut planning over to the VM supervisor on Studio 2026-11-19 23:31:42 -08:00

Nix Configuration

Declarative, reproducible system configuration for three macOS hosts using nix-darwin and Gnarbox using NixOS, plus cross-platform development environments for VA projects.

Architecture

This repository uses a dendritic (tree-like) modular architecture with flake-parts and import-tree. Configurations are organized by feature/capability rather than by host:

modules/
├── base/       # Core system: fonts, homebrew, nix-settings, zsh
├── dev/        # Development: cli-tools, editors, git
├── desktop/    # GUI: shared macOS apps plus NixOS gnome, gaming, and audio
├── services/   # Daemons/agents: Hermes, ollama, monitoring, fseventsd watchdog, NAS storage health, NAS share mounts, the bot service and its encrypted NAS backup, the voice service, SMB, syncthing, Dashy, Artifact Shelf, Pi Durable (Obsidian Sync/backup modules retained, unused), oMLX trial (imported, disabled)
├── hosts/      # Compositions: a6mbp, mbp, studio (Darwin), gnarbox (NixOS)
└── dev-envs/   # VA project environments

Each host imports and composes feature modules. See modules/README.md for detailed structure.

Hosts

mbp (personal macOS)

Personal MacBook Pro and mobile fallback with syncthing, Tailscale, a Studio-backed Hermes client, and shared personal desktop apps. Obsidian Headless Sync was retired on 2026-09-16 when the personal second brain moved to Apple Notes; /Users/bryan/second-brain is a frozen rollback archive that nothing on MBP synchronizes, commits, or pushes. Location: modules/hosts/mbp.nix

a6mbp (work macOS)

Work MacBook Pro with syncthing and work tools (AWS, Docker, DDEV, Slack, Zoom). Location: modules/hosts/a6mbp.nix

studio (home server and personal desktop macOS)

Bryan's daily desktop and home server, running the primary Hermes gateway and per-user Tailscale-only remote backends, plus ollama, open-webui, monitoring (Prometheus + Grafana), SMB mount, syncthing, and iCloud backup. It shares Bryan's personal desktop applications with the MBP while retaining the Studio-only service stack. Prometheus and blackbox-exporter run as user-owned system LaunchDaemons, but macOS Local Network Privacy still keys its grant to each Nix store path: after a rebuild that changes either binary, someone at Studio must allow it under Privacy & Security > Local Network before its LAN probes (Unraid) work again. They wait for the Nix volume before exec, while activation keeps monitoring state directories owned by the service user. Nix owns Hermes launchd supervision, permissions, ports, and Tailscale exposure; Bryan and Traci use isolated managed runtimes that update nightly and weekly, respectively. The guarded updater follows each installation's configured channel, accepts detached stable releases, and preserves only three reviewed local patches (the classic status-reporting compatibility fix, the matrix-send-through-gateway fix and the Rex program-status report) while refusing unrelated source changes. Actual updates announce their start and verified completion in Bryan's primary Matrix channel, while no-op checks stay silent. Monitoring alerts go out by email and, through the bot service's webhook (Steve posts them with no model turn), into the end-to-end encrypted "Studio Alerts" Matrix room; each channel reports the other's delivery failures. An fseventsd watchdog (root LaunchDaemon) exports macOS's file-change daemon's memory and CPU, alerts when they climb, and restarts it after 15 minutes over 2 GiB or 90% of a core, at most hourly, so a bloated fseventsd no longer needs a reboot; it has its own Grafana dashboard. NAS storage health alerts fire on new btrfs device errors reported by the NAS's node_exporter and when a write probe (every 10 minutes) can no longer write to the backup share; a filesystem's read-only flag can lag a failed pool, so neither signal relies on it. The bot service (bryan/pi-bots: the Matrix bots, their bridge and the job clock) runs as a launchd user agent from its checkout, with its pi-bots command on Pi Durable's agents' PATH for their notices, and Prometheus alerts when it, a bot, a bot's account or its job clock stops working, when a scheduled job fails, and when the SGG preview watchdog (one of its jobs) stops or leaves a preview it cannot bring back. Its state and secrets are archived nightly to the NAS, encrypted with age before they leave the Studio; a failed or overdue backup raises a Prometheus alert. Nix mounts that NAS share itself, with the password from the login keychain. Bryan's primary backend is available at https://bryans-mac-studio.tail5ba690.ts.net through Tailscale Serve. Ollama remains bound to loopback and is forwarded tailnet-only at http://100.121.238.48:11434. Every monitoring listener binds loopback except Alloy's Unraid syslog receiver (UDP 1514); Grafana, Prometheus and the Alloy UI are published tailnet-only through Tailscale Serve at https://bryans-mac-studio.tail5ba690.ts.net:33000, :9090 and :12345. Open WebUI binds loopback too; the Cloudflare Tunnel connector on Studio is its only client. Traci's isolated headless backend runs under her macOS account and is available at https://bryans-mac-studio.tail5ba690.ts.net:9120 through Tailscale Serve.

Studio manages the Jellyfin media server app through its host-specific Homebrew cask, so darwin-rebuild switch keeps it current.

Third-party agent memory is retired. Agents use their harness-native memory and history plus the existing project vaults and personal Apple Notes. Hindsight's service, dedicated database, proxy and scheduled upkeep are no longer declared; its encrypted backups and inactive local data are preserved, not imported into another memory system. Dotfiles owns removal of the Hindsight, context-mode and claude-mem client integrations.

The private Studio service portal is available tailnet-only at https://bryans-mac-studio.tail5ba690.ts.net:8088 (Tailscale Serve in front of a loopback listener), with a Pi Durable section linking each workspace's page. It uses the immutable Nixpkgs Dashy static build for links and a read-only local adapter that answers each tile's status dot from Prometheus's probe of that service; it has no public ingress, arbitrary proxy, or mutable web configuration.

Studio also runs the Artifact Shelf (services.artifact-shelf): one tailnet-only page at https://bryans-mac-studio.tail5ba690.ts.net:8092/ (Tailscale Serve in front of loopback Caddy on 8092, linked from the portal's Daily Services) holding every visual artifact Hermes prepares, each at a stable URL. Agents publish with the artifact-shelf CLI into ~/Library/Application Support/Artifact Shelf/, and a launchd agent rebuilds the index when items change and every 10 minutes, so items whose files disappear drop off the page by themselves.

Studio also runs the voice service (services.pi-bots-voice, bryan/pi-bots-voice): talk to a bot out loud from the phone. It runs by default as a launchd user agent from its checkout ~/code/pi-bots-voice, on that checkout's own service/.venv interpreter, listening on loopback 7860 and published tailnet-only through Tailscale Serve at https://bryans-mac-studio.tail5ba690.ts.net:7860/ (its test page, /client/, is linked from the portal's Daily Services). WebRTC audio is UDP on the Mac's own addresses, so each activation allows the venv's real interpreter through the macOS application firewall again, which covers uv updating Python. Its settings are the checkout's config.local.yaml; a code change there needs uv sync --frozen and a restart of the agent, not a rebuild (modules/services/AGENTS.md).

Studio also serves the Summit Point concept preview (services.summit-point-gallery) on loopback 127.0.0.1:4321. It is an unlisted, public-by-link design review preview for the separate private repository bryan/summit-point-site, exposed through one hostname, summitpoint.thompson.codes, on the existing remotely managed Cloudflare Tunnel. Caddy answers any other Host header with a 404. The served tree is the current symlink under ~/Library/Application Support/Thompson Codes/Summit Point Gallery/, staged by that repository's scripts/publish-review.sh as an immutable releases/<sha>/ build; rollback is scripts/publish-review.sh --rollback <sha>, an atomic symlink change that needs no rebuild and no activation. Responses are noindex/no-store. The preview carries no approved Summit Point content.

Studio runs the Pi Durable SGG PR pre-review module (services.pi-durable), including its sandbox proxy/firewall and TailNet-only page route, commissioned in October 2026. The declared application path is now the dedicated clean checkout ~/.local/share/pi-durable/sgg-deployment, separate from the human/agent workspace ~/code/durable-pi-workspace. Prepare and verify that deployment build before running the standard update-system; until activation the installed agent retains its old path. No activation is performed by editing this repository. Credentials, state, sandbox and route settings are unchanged. It also declares the model-provider proxy and the GitHub write proxy (durable-pi-workspace#268) on the sandbox network's gateway (8892 and 8893), on Nix's Node; each runs once Bryan's update-system activates it and its config exists. And the replay proxy (durable-pi-workspace#21), a second tinyproxy on the same gateway (8889) for the evaluation's replay VMs, whose allowlist holds the package hosts and never a GitHub host. Each Pi Durable VM network has an anchor agent that keeps one idle, detached VM attached, so Apple container never takes its bridge down or gives its bridge unit to another network (durable-pi-workspace#418); the VM outlives its agent, the sandbox network's anchor starts first, and Prometheus alerts when one has to be started again, isn't running, or is attached while its network has no gateway on the host. Bryan's agents may run sudo /usr/bin/killall InternetSharing, the networks' recovery, without a password, and nothing else. The workspace supervisor (durable-pi-workspace#443) runs as its own agent on the proxies' Node and starts each workspace's VMs from its definition (the usage sampler's first), with Prometheus alerts when a VM is down, a reconcile fails, it stops reporting, a workspace's updates are halted after a failed update, its volumes pass 80% of their disk budget, or its record export fails or goes stale; the planning network may reach the model proxy for that VM. Planning's sandbox VMs get a VM network of their own (durable-pi-workspace#535), with its own anchor VM, a sandbox proxy (tinyproxy, package hosts only, no GitHub) on its gateway and a pf anchor that lets it reach only that proxy and the forge broker; planning.launcher turns the old planning launcher and its port forwarder off together; Studio has them off since the cut-over, so the workspace supervisor serves planning's page on 8792. SGG's VMs get two networks of their own (durable-pi-workspace#555), each with its anchor VM and pf anchor: a service network that reaches only the model proxy, the GitHub proxy's service listener, the Forgejo proxy and the SSH port forwarders, and a sandbox network with its own sandbox proxy (today's allowlist, plus the GitHub proxy's read hostname forwarded to its read listener) and replay proxy, which reaches only those two and the Forgejo proxy; the host SGG service's network is unchanged. See deployment separation, commissioning inputs, and the application's workspaces/sgg/OPERATIONS.md.

Studio also imports the oMLX trial server module (services.omlx) with explicit, disabled trial settings: loopback port 8000, state under ~/.local/share/omlx-trial, one request at a time, the safe memory guard and a fixed 20 GiB SSD KV cache. It is an on-demand second inference runtime for trying GLM-5.3-Flash with SSD expert offload beside Ollama, not a replacement for it: Ollama, its Tailscale route and every client default stay unchanged. A normal update installs, downloads, starts and exposes nothing for it. Nix supervises only the launchd agent; the runtime is a reviewed, pinned, user-managed source install, and its preflight refuses to start until that runtime exists and oMLX's settings carry an API key with cross-origin access closed. The source/security/compatibility review, install route, commissioning and rollback runbook are in docs/omlx-glm53-trial.md.

The personal second brain lives in Apple Notes (iCloud folder Second Brain) since 2026-09-16 (decision record in the frozen archive: ~/second-brain/Decisions/2026-09-16-decision-apple-notes-personal-second-brain.md). Studio no longer runs Obsidian Headless Sync or the nightly vault-git-backup snapshot for /Users/bryan/second-brain; the archive repository and its remote are preserved unchanged as rollback history. After update-system, launchctl print gui/$(id -u)/md.obsidian.headless-sync and …/com.snowboardtechie.vault-git-backup should both report the agents as absent. Location: modules/hosts/studio.nix

gnarbox (NixOS desktop)

Gnarbox is a GNOME gaming desktop with Tailscale, a Hermes Desktop/CLI client of Studio's primary backend, and Pi for local agent work using Studio's Ollama models. Its fresh 26.05 installation supplies the storage layout in hardware-configs/gnarbox.nix; do not reuse the pre-Omarchy disk UUIDs or LUKS configuration. SSH is key-only, sudo still requires a password, and GNOME uses its normal screen-lock defaults. Syncthing is disabled on Gnarbox; its prior local configuration is preserved for rollback, and the retired personal second-brain archive must not be synced. Claude Code is installed with Anthropic's user-managed native installer under ~/.local/bin/claude instead of the lagging Nix package; its own updater owns future versions. Location: modules/hosts/gnarbox.nix

Shared Configuration

Managed hosts share common packages through feature modules on both Darwin and NixOS. All three Macs install Element Desktop as their Matrix client (modules/desktop/element.nix). Matrix is now mainly for bot alerts, so the client is native: it keeps notifying after its window closes, which neither Element's web build nor the Cinny web app can do, and it leaves Cmd-H to macOS (Cinny binds it to spoiler formatting). Cinny Desktop was dropped earlier because it was slow to reconnect after sleep; Gnarbox still installs it on its own. The iPad build of Element X runs on Apple-silicon Macs but can't be installed declaratively (mas doesn't support iPad apps).

Feature modules define both Darwin and NixOS aspects. Gnarbox is the published NixOS system output; other Linux machines use only the development flakes and manage their operating systems separately.

Prerequisites

Apple Silicon Macs (mbp, a6mbp, studio): Install Determinate Nix Installer:

curl -fsSL https://install.determinate.systems/nix | sh -s -- install --determinate

All macOS hosts also need Homebrew installed first. nix-darwin's homebrew module manages your Brewfile; it does not install Homebrew itself. If brew isn't already on the machine:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Gnarbox: NixOS is already installed. Before any flake activation, compare hardware-configs/gnarbox.nix with the live /etc/nixos/hardware-configuration.nix, especially the root, EFI, and swap UUIDs. Preserve the fresh installation's system.stateVersion = "26.05".

Installation

Clone the repository:

git clone https://git.snowboardtechie.com/bryan/nix-configs.git ~/code/nix-configs
cd ~/code/nix-configs

Build and activate:

macOS — Apple Silicon (mbp, a6mbp, studio):

First-time bootstrap of nix-darwin (Determinate has flakes enabled already):

sudo nix run nix-darwin/master#darwin-rebuild -- switch --flake '.#mbp'  # or '.#a6mbp', '.#studio'

Subsequent rebuilds:

darwin-rebuild switch --flake '.#mbp'

Gnarbox (on the NixOS machine): Clone this repository to ~/code/nix-configs, then evaluate and build before switching. Keep /etc/nixos and the prior boot generation available for rollback.

cd ~/code/nix-configs
nix --extra-experimental-features 'nix-command flakes' flake check --no-build
nix --extra-experimental-features 'nix-command flakes' build --no-link '.#nixosConfigurations.gnarbox.config.system.build.toplevel'
sudo env NIX_CONFIG='experimental-features = nix-command flakes' nixos-rebuild switch --flake '.#gnarbox'

After switching, authenticate the existing tailnet interactively with sudo tailscale up (do not put auth keys in Git or command history). Verify tailscale status and SSH access before rebooting. Hermes is client-only; connect the Desktop app to Studio's authenticated remote backend at https://bryans-mac-studio.tail5ba690.ts.net using its normal login flow, not a second local gateway. Confirm remote authentication in the app rather than inferring it from a successful Nix build.

Next, clone the dotfiles to ~/code/dotfiles and follow its Gnarbox Stow preflight (stow -n -v before apply) and setup script. Git identity and any signing credentials are machine-local and must not go into this flake. Pi and Zed use Studio Ollama over the tailnet at http://100.121.238.48:11434; Gnarbox does not run another Ollama server or install OpenCode. Verify /api/tags and a real completion from Gnarbox after Tailscale authentication before claiming that AI connections work.

Usage

Obsidian Headless (retired 2026-09-16; procedure kept for rollback)

The obsidian-headless and vault-git-backup modules remain in modules/services/ but no host enables them: the personal vault they served is frozen and Apple Notes is authoritative. Re-enabling them on a host is the rollback path and requires the steps below again. Do not use the stale Syncthing copy at /Users/bryan/notes/second-brain.

Historical procedure (one host at a time, Studio first, then MBP):

  1. In desktop Obsidian, open /Users/bryan/second-brain, disable the core Sync plugin, and quit Obsidian. Disable automatic commit, pull, and push actions in the Obsidian Git community plugin as well. Desktop Obsidian may be reopened after Headless Sync is healthy, but its Sync plugin must remain off.
  2. Verify .obsidian/core-plugins.json contains "sync": false. Do not continue while it is true.
  3. Apply the host configuration only after step 2: darwin-rebuild switch --flake '~/code/nix-configs#studio' on Studio or darwin-rebuild switch --flake '~/code/nix-configs#mbp' on MBP. The managed job waits without a crash loop while interactive setup is incomplete.
  4. Log in without command-line credentials: ob login.
  5. List existing remote vaults: ob sync-list-remote. Select the existing remote vault; do not run ob sync-create-remote.
  6. Connect the existing local vault, allowing any E2E password to be prompted interactively: ob sync-setup --vault "<existing-vault-name-or-id>" --path /Users/bryan/second-brain --device-name studio on Studio, or use --device-name mbp on MBP. Do not use --password, reset history, or create a replacement remote.
  7. Keep core-plugin activation state device-specific: ob sync-config --path /Users/bryan/second-brain --configs "app,appearance,appearance-data,hotkey,core-plugin-data". Omitting core-plugin prevents the phone's enabled Sync state from overwriting the disabled Mac state, and prevents the Mac state from disabling Sync on the phone.
  8. Verify configuration with ob sync-status --path /Users/bryan/second-brain; its Configs line must list core-plugin-data but must not list a standalone core-plugin entry.
  9. Start the configured managed process immediately: launchctl kickstart -k gui/$(id -u)/md.obsidian.headless-sync.
  10. Inspect /tmp/obsidian-headless.log and /tmp/obsidian-headless.error.log, then rerun ob sync-status --path /Users/bryan/second-brain and verify .obsidian/core-plugins.json still contains "sync": false before reopening desktop Obsidian.

Before Studio's first scheduled Git snapshot, review exactly which untracked, non-ignored files it would include:

git -C /Users/bryan/second-brain ls-files --others --exclude-standard

The nightly job logs to /tmp/vault-git-backup.log and /tmp/vault-git-backup.error.log. Any nonzero result requires manual investigation; do not respond by pulling, rebasing, resetting, or force-pushing automatically. MBP's .git directory remains untouched, but no agent or plugin on MBP may commit, pull, or push this vault.

The corresponding agent policy lives in the second-brain repository's AGENTS.md, which now marks that vault as a frozen archive.

GitHub incident recovery watchdog

The tracked monitor in scripts/check-github-status.py polls GitHub's official Statuspage summary every five minutes and emits a timestamp-free snapshot. Hermes suppresses unchanged ticks and uses the OpenAI Codex subscription only when the official status changes. This incident-specific finite watch stays silent for its initial baseline and source-health noise, notifies Bryan in Matrix when service meaningfully improves or worsens, and automatically stops after 36 checks (about three hours). The recreatable job definition is scripts/github-status-watch.job.json.

Apply Changes

darwin-rebuild switch --flake '~/code/nix-configs#mbp'

Update Dependencies

nix flake update
# then rebuild using commands above

Development Environments

Cross-platform development environments for VA projects:

Linux machines use these nix develop outputs without consuming a system configuration from this repository.

  • vets-website: Node 22.22.0, Yarn 1.x, Cypress → vets-website
  • next-build: Node 24, Yarn 3.x, Playwright → next-build
  • component-library: Node 22, Yarn 4.x, Puppeteer → component-library
  • content-build: Node 14.15.0, Yarn 1.x, Cypress → content-build
  • simpler-grants: Node 20, Python 3.11, pnpm (corepack) → simpler-grants-protocol (Poetry must be installed separately via brew install poetry or pipx install poetry)

Activate manually:

nix develop '~/code/nix-configs#vets-website'

Development environment definitions are located in modules/dev-envs/.

OpenCode

The OpenCode CLI is installed via Homebrew (opencode) on managed macOS systems. The OpenCode desktop app (opencode-desktop cask) is installed on mbp.

Authentication:

Authenticate your AI providers:

opencode auth login

Usage:

Start the CLI:

opencode

Documentation:

Resources

2 gits, one repo

The primary repository is at git.snowboardtechie.com, with a push mirror on GitHub.

License

This configuration is free to use and modify for your own purposes.