Personal macOS config: nix-darwin (system) + Home Manager (user), driven by this flake. The same flake also builds the NixOS guests of the Proxmox VMs stack, and the home of non-NixOS Linux hosts; Windows hosts get omp, Tern and SSH from the Mac.
Hosts le and lex are entries in the hosts table in flake.nix (hostname → macOS username). Nothing else names a user or a /Users/<name> path: home directories, system.primaryUser, Home Manager, Homebrew and nix trusted-users derive from that entry, and just check fails on a hardcoded one.
The first part of this README is about the Mac (commands, setup, secrets, shell, apps). Then Non-NixOS Linux hosts (Arch, CachyOS) and Windows hosts. The last part, from Proxmox VMs, is about the NixOS VMs.
- Daily commands
- Layout
- New machine
- New host
- Secrets
- Shell
- Homebrew
- Herdr
- OmniWM
- LinearMouse
- Tern keymap
- Tern plugin: remote-open
- Tern plugin: no-traffic-lights
- Tern plugin: scrollback-editor
- Non-NixOS Linux hosts
- Windows hosts
- Proxmox VMs
- One-time setup
- VM operations
- Roles
- Choosing a role: clean or agent
- What agent is
- Login
- omp
- mise
- Tern
- Podman and zram
- Docker: rootless only, with Compose
- Jumphost: a shell, and its Docker as a context
- just, lazygit, lazydocker, tokei, btop, kubectl, k9s, superfile and zoxide
- bao, secretspec and the tunnel for the vault login
- SSL_CERT_FILE
- Interactive zsh
- A headless browser for the browser tools
- Clean to agent
- Agent to clean
- Personal setup: Hindsight, plugins, skills
- Hindsight
- Mason language servers for omp
- Identity: fixed at install
- Disk encryption and unlock
- Offline copies
- Recovery
- Unreachable after boot
- Stage 2 has no network, or the identity files are wrong
- vm-unlock stops with a host key error
- Reinstall
- Kexec failed while the VM still runs Debian
- State store unreachable before a run starts
- State store dropped during an apply
- Stale lock
- Back up the state object
- Restore the state object
- The object no longer decrypts
- Notes
| Command | What it does |
|---|---|
just switch |
Full nix-darwin rebuild + activate. Needs sudo. Same OmniWM settings.toml preflight as just home. |
just home |
Home Manager only. No sudo. Use for zsh / home.file / secretspec materialization. If ~/.config/omniwm/settings.toml is a regular file, reviews the diff then y/N before replacing it with the repo symlink. |
just openbao-login |
Keycloak SSO → ~/.vault-token. Required before activation can pull secrets. |
just secretspec-status |
Read-only: each secret's sync state against OpenBao (in-sync, behind, ahead, …), then a check that the secretspec CLI still reads the values this engine writes. |
just secretspec-sync |
Review the secrets that need a decision and push or pull them. Needs a terminal. just secretspec-sync --push NAME pushes the local file of one secret without prompts. |
just test-secrets |
Engine tests against a throwaway bao server -dev (needs bao, jq, python3; no network). Part of just validate. |
just secretspec-enforce-cas |
Once, after both Macs run this engine: OpenBao then refuses writes to the secrets without check-and-set. Needs the patch capability on secret/metadata/secretspec/dotfiles/default/*. |
just update-all |
just update → just switch → just brew-upgrade. |
just brew-upgrade |
brew upgrade on demand. just switch does not upgrade Homebrew. Runs just switch first when flake.lock is newer than the active system (taps sync on switch). Casks that remove launchctl services (VS Code, Discord) prompt for sudo mid-run; a shell sudo -v can't pre-authorise Homebrew's own sudo. |
just update |
nix flake update (lockfile only). |
just gc |
nix-collect-garbage -d. |
just --list |
Everything else (check, fmt, lint, build, trace). |
just with no args runs switch.
After just home / just switch, a new shell (or exec zsh) is required for zshrc / keymap changes. Running shells keep the old init.
The Proxmox VM recipes (infra-plan, vm-install, vm-deploy, …) are described under Proxmox VMs.
flake.nix hosts table (hostname → username) → darwinConfigurations
justfile the commands above
lib/builders.nix mkDarwin: HM, nix-homebrew, overlays
hosts/<name>/ optional host-only tweaks (hosts/le: display mode)
hosts/common/ shared darwin defaults (owner name, nix, TouchID sudo, keyboard)
profiles/development.nix CLI / k8s / fonts
profiles/personal.nix Homebrew casks + personal packages
home/default.nix Home Manager: packages, programs.*, activation
home/zsh/ zshrc + aliases / options / keybindings
secretspec.toml secret *names* only (no values)
home/secretspec/ secret-sync engine (materialize.sh + libs, tests), nix wrapper, secretspec provider aliases
home/omniwm/ OmniWM settings.toml (out-of-store symlink) + adopt.sh
home/linearmouse/ LinearMouse settings JSON (out-of-store symlink)
home/herdr/ herdr config.toml + herdr-plus quick-actions
infra/ Proxmox VMs: Terragrunt unit, secretspec manifest (names only), leak check, VM scripts
hosts/nixos/ generic NixOS guest role (proxmox-guest, role clean)
modules/nixos/ agent-dev: the module behind role agent (proxmox-agent), with the pinned omp
home/linux/ Home Manager of the agent role's user (not the Mac's home/default.nix)
Profiles are boolean toggles on lib.mkDarwin in flake.nix, not files under hosts/common/profiles/.
-
Install Nix (Determinate), Xcode CLT, clone this repo to
~/.dotfiles(fixed path: OMP and OmniWM config are live symlinks into this checkout). -
curl -sSL https://install.secretspec.dev | sh -
just openbao-login -
First activation (nix-darwin not on PATH yet):
nix run nix-darwin -- switch --flake .#<hostname><hostname>is thehostskey for this Mac; the switch renames the Mac to it, so afterwards plainjust switch/just homefind it. -
mise install(language runtimes are mise, not nix packages).
Activation will refuse if OpenBao is unreachable or a declared secret is missing. See Secrets.
Atuin sync logs itself in during that activation (atuinLogin); no manual atuin login.
-
Add the Mac to
hostsinflake.nix, keyed by the hostname you want it to have:<hostname> = {username = "<id -un on that Mac>";};
Add
homeDirectory = "/Users/<folder>";only if the home folder name differs from the username. Anyprofiles/systemset there override the defaults. -
Optional:
cp -r hosts/_template hosts/<hostname>for host-only settings (display mode, extra packages). -
First activation as in New machine step 4;
just switchafterwards.
just home builds the Home Manager config of the user running it (id -un), not of a user named after the host.
The live path is homelab OpenBao, not SOPS. home/secretspec/materialize.sh keeps the 14 secret files in sync with it.
- The nix wrapper
dotfiles-secrets(inhome.packages) pins itsbao,jqand coreutils, so your ownbaois left alone. - The
just secretspec-*recipes run the wrapper of the active Home Manager generation, so they work right afterjust home. - A bare
dotfiles-secretson PATH only followsjust switch.
- Manifest:
secretspec.toml([profiles.default]) lists the names. The table of names, paths and modes is inmaterialize.sh; a test keeps the two lists equal. - Values:
secret/secretspec/dotfiles/default/<NAME>onhttps://openbao.home.0dl.me(KV v2, fieldvalue). Every file is byte-exact, trailing newlines included. - Direction is proven, not guessed. Each Mac keeps one record per secret,
~/.local/state/dotfiles/secretspec/<NAME>.base.json: the vault version and bytes both sides last agreed on. KV v2 version numbers and bytes decide; clocks are display only.
home.activation.secretspecSecrets runs dotfiles-secrets apply on every just home / just switch.
- It pulls what is safe (no local file, or only the vault changed). It never writes the vault and never prompts.
- Anything that needs a human (local edits, both sides changed, vault rewound or empty, no record, a symlink in the way) prints one banner that points at
just secretspec-sync, and the switch goes on. - Vault unreachable (network, timeout, 5xx, 429, sealed): files are kept and the switch goes on for up to 7 days after the last successful contact.
- Rejected credentials (401/403) fail with the fix (
just openbao-login). A TLS error fails and says to install the CA that signed the certificate. - A secret missing from both the vault and this Mac always fails.
home.activation.atuinLogin runs home/secretspec/atuin-login.sh after materialize and Home Manager's linkGeneration. It needs config.toml: any earlier, atuin writes its default config and targets Atuin's hosted server.
atuin statusOK → nothing (the password is not read).- Otherwise it runs
atuin login -u loneexile --key ""withATUIN_PASSWORDfrom OpenBao (argv only, never on disk).--key ""reuses the synced key file without rewriting it, soATUIN_KEYstays in sync. - Login or network failures print a
!!!!banner and activation continues. ATUIN_PASSWORDmissing while logged out fails activation.
just secretspec-statusis read-only.just secretspec-syncneeds a terminal. It shows masked summaries that never print values.vopens a read-onlynvimdiff of private copies (when both sides changed, the base is the middle window), andmmerges. A one-slot backup goes to~/.local/state/dotfiles/secretspec/backup/<NAME>before "take vault" and before a merge replaces the file.just secretspec-sync --push NAMEpushes one file without prompts. Use it after you edit a secret file (or runjust secretspec-syncto review everything). Every push is check-and-set and is read back.
- Never
secretspec deletethese keys. It destroys every version and the history the engine reasons from.secretspec setdrops thewriterfield and writes without check-and-set; usejust secretspec-sync --push NAMEinstead. - Login:
just openbao-login(the recipe name isopenbao-login, notsecretspec-login). - Binary:
~/.cargo/bin/secretspec(install script, not the nixpkgs package) is still used byatuin-login.sh(ATUIN_PASSWORD) and by the contract check injust secretspec-status. The sync engine does not call it. - Tests:
just test-secrets.
SOPS is leftover, not live: no secrets/secrets.yaml, no sops.secrets.* in any host/profile. What remains is the sops-nix input, mkDarwin's unused darwin module, .sops.yaml, and secrets/note.md. Ignore those; do not put tokens in programs.atuin.settings or git.
- zsh + Starship. Completions are cached after
compinit(do notsource <(tool completion zsh)on every start). - Ctrl-R:
atuin-fzf-widget— Atuin's synced DB piped through real fzf (--scheme=history). Enter fills the prompt; it does not run the command. Atuin is told--disable-ctrl-rso it never binds the key. - Ctrl-T / Alt-C: fzf file / directory widgets (
programs.fzf.historyWidget.commandis empty on purpose). - Native Atuin TUI:
atuin search -i. - Atuin config:
programs.atuin.settingsinhome/default.nix.config.tomlis a read-only store symlink, so/model,atuin setupandatuin config setcan't save; change settings in nix. - The AI token is not in
programs.atuin.settings(a token there would override it). It comes from secretspecATUIN_AI_TOKEN→~/.config/atuin/ai-token, and zsh/bash shells that have a TTY export it asATUIN_AI__API_TOKEN. New shells pick it up;exec zshafter it changes. - To give Ctrl-R back to Atuin: drop
"--disable-ctrl-r"fromprograms.atuin.flagsand delete theatuin-fzf-widgetmkOrder 2000block inhome/default.nix, thenjust homeandexec zsh.
- Taps are flake inputs (
flake = false), registered innix-homebrew.taps(lib/builders.nix). - Adding a third-party formula/cask is that plus
homebrew.brews/homebrew.casks, thennix flake lockandjust switch(notjust home). - Tap trust is automatic:
profiles/personal.nixmarks every non-homebrew/taptrustedin the Brewfile. That is the only trust that survives activation (brew bundle --force-cleanuprewrites~/.homebrew/trust.jsonfrom the Brewfile).
homebrew.onActivation.upgrade = falsesojust switchstays offline-ish.just updateonly moves the lockfile. The taps under/opt/homebrew/Library/Tapsare synced from it byjust switch, and upgrading against stale taps fails for formulae with moving download URLs (lightpanda'snightlyasset).just brew-upgradetherefore switches first whenever the lock is newer than the active system.just update-allis the explicit one-shot.
herdris mise (herdr = "latest"inhome/default.nix), not a nix package.- herdr-plus is a herdr plugin, not a Homebrew tap: the tap only installs a PATH binary and does not register actions.
home.activation.herdrPlusPluginrunsherdr plugin install cloudmanic/herdr-plus --yeswhenplugins.jsondoes not already list it.- Config:
home/herdr/config.toml(prefix+o projects, prefix+y quick-actions) andhome/herdr/quick-actions/.
- herdr has no screen detection for omp. omp's working/idle/blocked state comes only from herdr's omp extension (
~/.omp/agent/extensions/herdr-omp-agent-state.ts). - Without it every omp pane reads idle in the sidebar and
resume_agents_on_restorecannot resume omp. home.activation.herdrOmpIntegrationrunsherdr integration install ompunlessherdr integration statusalready reports it current.- Running omp sessions only load it after a restart.
- OmniWM opens its command palette on ⌃⌥Space. macOS ships the same chord as "Select next source in Input menu", so both fire and OmniWM's Health page warns.
home.activation.omniwmPaletteChordturns the macOS shortcut off (symbolic hotkey 61) withdefaults write -dict-add, which leaves every other system shortcut as it is.- It then applies the change with
activateSettings -u, so no logout is needed.
- LinearMouse is the
linearmousecask. Its settings arehome/linearmouse/linearmouse.json, linked out of store to~/.config/linearmouse/linearmouse.json. - The repo copy turns on smooth scrolling (preset
easeInOut, no rubber-band bounce) for every device LinearMouse counts as a mouse. The built-in trackpad and the scroll direction (com.apple.swipescrolldirectioninhosts/common) are left alone. - The Toucan2 trackpad (vendor
0x1d50, product0x615e) has its own scheme after that one: presetlinearwith acceleration 0, so scroll speed is proportional to finger speed (any acceleration above 0 runs the input through a steep curve that made slow swipes crawl and quick ones jump), and inertia 0.3 for a short glide. Tune Speed and Inertia in LinearMouse with the Toucan selected. - The Settings window writes through the link into this working tree, so its changes show up in
git status; commit them. The file is plain JSON: comments break parsing. - LinearMouse reads
~/Library/Application Support/linearmouse/linearmouse.jsonfirst when that file exists, which would hide the repo copy. Delete it if it shows up. - First launch after
just switch: grant Accessibility in System Settings → Privacy & Security, then turn on Start at login in LinearMouse. Neither can be set from nix.
Tern runs its tmux preset with prefix ⌃A (keymap and keymap_prefix in home/tern/settings.json), so that its chords match herdr's (home/herdr/config.toml). The keybinds object holds only what differs from the preset.
- herdr chords with a Tern command:
hjkl(focus_pane:*),|(split_right),-(split_down),1–9(goto_tab:N),shift+x(close_tab),shift+n(new_session),shift+w(rename_session),shift+d(close_session),shift+s(preferences),shift+r(reload_config),e(open_scrollback),b(toggle_sidebar),tabandshift+tab(next_pane,previous_pane),q(quit: herdr's detach, and Tern's panes live on in its daemon),?(help). - Chords that already match in the preset:
c,n,p,,,x,z,s(the session switcher),w(Mission Control, the preset default). - herdr chords with no Tern command, left as the preset has them:
o(herdr-plus projects; Tern'snext_pane),y, the annotate chords (a,shift+a,m,d,shift+o),shift+g(new worktree),shift+p(rename pane),r(resize mode). - Plugin chords, free in both keymaps:
v(plugin.remote-open.render, Render in browser). herdr's ownvdefault is not used here:split_verticalis on|. - The preset's digits are zero-based (⌃A 1 is the second tab), so the nine
goto_tab:Nentries stay: herdr's1–9are tabs 1–9.0is unbound. - A normal Preferences save keeps
keybinds. The Keyboard page's "Restore all defaults" deletes the whole map (Tern 0.7.2).just homeputs it back: the live file differs from the repo copy, so it is kept assettings.json.dotfiles-backupand the repo copy is installed.just tern-capturepulls Preferences changes into the repo the other way. - Tern does not reload
settings.jsonwhen it changes on disk (measured on 0.7.2). Afterjust home, run Reload settings in the command palette (or restart Tern). Until then the running Tern holds the old keybinds, and its next Preferences save writes them back over the file. - Free in both keymaps, if you want Tern's desktop pet on a chord:
"ctrl+a>shift+c": "clawdi".
remote-open makes links in a pane of a remote host work on the Mac:
- a
file://link to an html, svg, pdf or image file (copied withscp, shown in Tern's browser block); - an image (
png jpg jpeg gif webp), as afile://link or a plain path: shown in a small viewer whose Copy image puts it on the Mac's clipboard and Save to Downloads copies it into~/Downloads(since 0.2.0); - a
localhostlink; - an OAuth sign-in URL whose
redirect_uriis on localhost (this and thelocalhostlink start anssh -Lforward; the OAuth one closes itself after ten minutes). - an HTML file open in a file block (since 0.3.0): ⌃A v, or Remote Open: Render in browser in the palette, shows it as a page in Tern's browser block and leaves the file block open for editing. A remote file is copied with
scpfirst; a file on the Mac is served where it is. It shows the saved file: save first.
⌥-click leaves a link to Tern. The plugin needs ssh to the VM without a prompt and the VM's key in known_hosts.
The pin lives in home/default.nix: home.file."Library/Application Support/Tern/plugins/remote-open", a pkgs.fetchFromGitHub store path (Darwin only), not a link to a checkout.
To bump it, set rev to the new commit and hash to the one that nix flake prefetch github:LoneExile/tern-remote-open/<rev> prints, then just home.
Do not also run tern plugin link on it: two packages with the same id are a duplicate-id error. tern plugin list must show remote-open … ready.
Pasting an image into a remote pane depends on the version of Tern on the VM (tern remote update) and on omp's opt-in to paste events (see Image paste into omp on the VM), not on this plugin.
Removes the window's close, minimize and full screen buttons. Tern has no setting for that, so it takes two pieces:
home/tern/settings.jsonhas"system_traffic_lights": false(Settings › Appearance › System traffic lights). Tern then draws its own buttons in the page (.tl-ctl) in place of macOS's, which no style sheet can reach.home/tern/plugins/no-traffic-lightsis a style sheet that hides.tl-ctland gives the 90px it reserves back to the tab bar. Itswindow.luauis empty: Tern's manifest needs an entry. Home Manager links it into Tern's plugins folder as a store path;tern plugin listmust showno-traffic-lights … ready.
Either piece alone leaves the buttons. Without them, the menus still have File › Close, Window › Minimize and Zoom, and View › Enter Full Screen (macOS's menu roles, with their usual shortcuts unless a Tern keybind takes the chord). Turn system_traffic_lights back on, or remove the plugin, to get the buttons back.
A running Tern keeps its settings in memory: after just home, run Reload settings (⌃A ⇧R, or the command palette) or restart Tern.
⌃A e (open_scrollback, Open scrollback in editor) opens the focused pane's scrollback in nvim, or in vim when the host has no nvim (the agent VMs have only vim). Tern has no vi copy mode, so this is the keyboard way to select and yank terminal output.
- Tern's own command writes the scrollback to
$TMPDIR/tern-scrollback-<pid>-<pane>.txtand opens it in the Mac's default text app (TextEdit), whateverEDITORorVISUALsay (measured on Tern 0.7.3). home/tern/plugins/scrollback-editoroverrides it for terminal and agent panes. A new tab in the pane's session captures the whole scrollback withtern capture <pane> --scrollbackinto amktempfile, opens it at its last line, and removes the file when the editor quits; the tab closes with it. Other pane kinds keep Tern's own command.- Home Manager links it into Tern's plugins folder as a store path;
tern plugin listmust showscrollback-editor … ready. Afterjust home, runtern plugin reload(or restart Tern). - Measured in an isolated Tern window on the Mac: nvim opened with all 300 lines of a test command and the prompt, and
:qclosed the tab and removed the file. In a pane of an agent VM the new tab runs on the VM, wheretern captureand vim exist; that path was not tried from a real window. If the capture fails, the tab says so and waits for Enter. - The new tab is titled by its command line (
f=$(mktemp).
A Linux machine that is not NixOS (Arch, CachyOS) gets the agent VMs' home from a standalone Home Manager config: the Mac's zsh files and plugins, starship, the tools, omp, mise, gh, bao and secretspec, the captured omp plugins, the Mason servers and the Tern remote service, plus Neovim. The desktop and the rest of the system stay the distribution's (pacman, paru); what the dotfiles add to them, packages and root settings, is in hosts/linux/<hostname>/ (System packages and settings).
- Hosts.
linuxHostsinflake.nix(hostname →username,system); the pieces a host turns on, and its non-NixOS paths, inhosts/linux/<hostname>.nix. - System side.
hosts/linux/<hostname>/: the pacman and AUR lists andsystem.conf, applied byjust arch-packagesandjust arch-system, checked byjust arch-check. - Pins. The pieces' packages come from
modules/nixos/agent-dev/packages.nix, the file the VMs read too. - Neovim. The nightly build the Mac runs (
neovim-nightly-overlay), and https://github.com/LoneExile/nvim cloned once to~/.config/nvim: a later switch never pulls or replaces it, and a switch without network only warns. - No secrets. Nothing from OpenBao is written. Run
gh auth login, and write~/.omp/.envand~/.config/nvim/.env.luayourself. - Checks.
just checkon the Mac evaluates every Linux host, so a change that breaks one fails on the Mac first. - Updates.
sudo pacman -Syuweekly, and reboot after a kernel or Mesa update. snap-pac snapshots each transaction, and the Limine boot menu lists the snapshots. CachyOS'spacman.conf.pacnewis Arch's stock file, without CachyOS's repos and with[multilib]off: keep the current file and delete the.pacnew.
-
Add it to
linuxHosts:<hostname> = {username = "<user>"; system = "x86_64-linux";};. Copyhosts/linux/rex.nixtohosts/linux/<hostname>.nix, andhosts/linux/rex/tohosts/linux/<hostname>/: edit its lists andsystem.conf, and replacecachyos-base.txtwith the host'spacman -Qqeright after its install. -
On the host, the one-time root steps. They clone this repo to
~/.dotfiles. -
Switch the first time (no
justyet; Home Manager is the flake's locked input):cd ~/.dotfiles && nix run --inputs-from . home-manager-nixos -- switch --flake .#<hostname> -b hm-backup
A file in the way is kept as
<name>.hm-backup(CachyOS:~/.zshrc). -
mise install: Neovim's Mason needs node; the other tools also install on first use. -
just arch-packages, thenjust arch-system(its root part again, allok, and the user units). -
From the Mac:
tern remote setup <user>@<ip>, thentern remote doctor <user>@<ip>. Itslinkedwarning is expected: the service serves with--relay none.
After that, just switch in ~/.dotfiles on the host. A host with no entry gets no homeConfigurations.<host> in this flake.
In this order: /nix must be its own subvolume before Nix writes to it.
-
/nixon its own Btrfs subvolume, so snapper's snapshots of/(one pair for every pacman transaction) leave the store out:uuid=<UUID of the / line in /etc/fstab> sudo mkdir -p /mnt/btrfs-top && sudo mount -o subvolid=5 "UUID=$uuid" /mnt/btrfs-top && sudo btrfs subvolume create /mnt/btrfs-top/@nix && sudo umount /mnt/btrfs-top && sudo rmdir /mnt/btrfs-top && sudo cp -p /etc/fstab /etc/fstab.pre-nix && echo "UUID=$uuid /nix btrfs subvol=/@nix,defaults,noatime,compress=zstd:1 0 0" | sudo tee -a /etc/fstab && sudo mkdir /nix && sudo systemctl daemon-reload && sudo mount /nix findmnt -no SOURCE /nix; ls -A /nix; sudo findmnt --verify # [/@nix], empty, no errors
One chain: a step that fails stops it before
/etc/fstabchanges. The mount options are the ones of the other subvolumes' lines. -
sudo pacman -S --needed nix git,git clone https://github.com/LoneExile/.dotfiles ~/.dotfiles, and the host's server values in~/.config/dotfiles/arch-system.env:UFW_SUBNETS="<subnet> <subnet>", the subnets the Mac comes from. -
The root settings of
system.conf(nojustyet). Keep an SSH session open until a new key login works, as this turns password logins off:sudo bash ~/.dotfiles/hosts/linux/arch-system.sh system ~/.dotfiles/hosts/linux/<hostname> <user> sudo systemctl start nix-daemon.service # once: the daemon makes /nix/store sudo sshd -T | grep -i '^passwordauthentication' # no
The Mac's Nix settings (
lib/builders.nix) go to/etc/nix/nix.conf; no group is needed, the package lets every user use the daemon.
hosts/linux/<hostname>/ holds what the dotfiles add to the distribution, run by hosts/linux/arch-system.sh (tested by arch-system_test.sh).
- Lists.
pacman.txtandaur.txt: the packages the host adds.cachyos-base.txt: the ones its installer chose, so a package installed by hand and never listed shows up as unlisted. - Settings.
system.conf: system units to enable and to keep off, user units, linger, login shell, SSH keys only,nix.conf, greetd autologin, Wake-on-LAN, ufw rules. The subnets the rules allow are server values:UFW_SUBNETSin~/.config/dotfiles/arch-system.envon the host, never in the repo. just arch-packagesinstalls what the lists name and the host lacks. An AUR package is built with makepkg as you (its repo dependencies installed first, as dependencies) and installed with pacman;paruupdates it later. sudo asks for the password once: the script keeps the credential fresh while a build runs, so a long source build doesn't ask again.just arch-systemappliessystem.conf: the root part through sudo, then the user units.just arch-checkreports what is missing, unlisted or different, changing nothing; it exits 1 on any drift.- Rules. Nothing is ever uninstalled or removed. Each step changes only what differs and prints
ok:orchanged:. A rewritten file keeps its previous version as<file>.dotfiles-backup. The SSH drop-in (10-keys-only.conf, read before CachyOS's own; sshd keeps the first value) is tested withsshd -tand rolled back if rejected. greetd's[initial_session], with the comments above it, is the dotfiles' block. The script never enables ufw, and only checks that/nixis the@nixsubvolume. - Add software. A line in
pacman.txtoraur.txt, commit, thenjust arch-packageson the host. It builds an AUR package without asking, so read its PKGBUILD (paru -Gp <pkg>: the sources, checksums and any.installscript) before adding the line. - rex's services. Docker through
docker.socket, used withsudo docker(no docker group: it equals root); a published port bypasses ufw (Docker's iptables rules forward it before ufw sees it), so publish on127.0.0.1(-p 127.0.0.1:8080:80) unless the LAN should reach it. Syncthing as a user unit (pair devices in its web UI, 127.0.0.1:8384); WARP's daemon off until WARP is wanted, as a connect reroutes rex; Tailscale installed, not running (sudo systemctl enable --now tailscaled, thensudo tailscale up).
- Home: in
~/.dotfiles,nix run --inputs-from . home-manager-nixos -- generations(thehome-managercommand is not installed), then run<generation>/activateof an older one; or restore the*.hm-backupfiles. - Shell:
sudo chsh -s <old shell> <user>. SSH: remove10-keys-only.confand reload sshd. - Nix: disable
nix-daemon.socket,sudo pacman -Rns nix, unmount/nix, drop its fstab line, delete@nix. - System side: change
system.confor a list back (the script re-applies what they say, and removes nothing); a rewritten file's previous version is<file>.dotfiles-backup. - ufw:
sudo ufw status numbered,sudo ufw delete <n>. Linger:sudo loginctl disable-linger <user>. - Rolling
/back to a snapshot also rolls back pacman'snix, while/nixstays current: updatenixagain before using it. Booting a snapshot older than the/nixfstab line leaves/nixunmounted. - Graphical programs stay the distribution's: Home Manager's GPU driver setup for Nix programs is off.
- rex's mise has no Python (
hosts/linux/rex.nix): Arch's own Python tools (powerprofilesctl, whichgame-performanceruns) start with#!/usr/bin/env python3and need pacman's Python and its system modules.
Sunshine on rex streams its Hyprland session to Moonlight on the Mac (the moonlight cask).
- Sunshine: in
pacman.txt(thecachyosrepo's build, a pre-release); its user unitapp-dev.lizardbyte.app.Sunshine.serviceis insystem.confand starts with the graphical session. - Its settings:
~/.config/sunshine/sunshine.confis a writable copy ofhosts/linux/rex-sunshine.conf(the RX 9070 onrenderD128, KMS capture, the VA-API encoder), so the web UI can still save. The pairing state (sunshine_state.json) and the web UI login (credentials/) stay on the host. - Firewall: the Sunshine ports are
UFW_RULESinsystem.conf, allowed from each subnet ofUFW_SUBNETS. The web UI port 47990 stays closed:ssh -N -L 47990:localhost:47990 <user>@<ip>, then https://localhost:47990. - Autologin:
GREETD_AUTOLOGINinsystem.confbecomes greetd's[initial_session](uwsm start -e -D Hyprland hyprland.desktop, as the user); greetd runs it once per boot. Thelock-after-autologinuser service (hosts/linux/rex.nix) locks that session, and only in the first 5 minutes after boot: it asks Noctalia until logind reports the session locked (loginctl show-session <id> -p LockedHint), and fails if that takes over 60 s. Lock rather than log out: a logout stops Sunshine until the next boot. - Pairing: in Moonlight, add
<ip>; it shows a PIN; enter it in the web UI's PIN tab. - Power: in the BIOS, Restore AC Power Loss → Power On (rex comes back after a power cut) and Power On By PCI-E; Wake-on-LAN is
WOL_CONNECTIONinsystem.conf(from the connection's next activation;sudo ethtool <nic>showsWake-on: g). Moonlight's wake works on the home LAN only. - Rollback: take Sunshine out of
pacman.txt,system.conf(its user unit,GREETD_AUTOLOGIN, itsUFW_RULES) first, or the script puts it back; then remove the[initial_session]block,systemctl --user disable --now app-dev.lizardbyte.app.Sunshine.service,sudo pacman -Rns sunshine, and the ufw rules (sudo ufw status numbered,sudo ufw delete <n>).
Steam only, set up per the CachyOS gaming guide for an RX 9070 XT and a Ryzen 7 9850X3D. Played at rex's own desktop or streamed through Sunshine (its "Steam Big Picture" app); Hyprland keeps running, as Sunshine streams its session.
- Packages: in
pacman.txt:cachyos-gaming-meta steam gamescope mangohud lib32-mangohud. The meta-package brings Proton-CachyOS (proton-cachyos-slr), Wine-CachyOS, umu-launcher, protontricks and vulkan-tools. - Shader cache:
MESA_SHADER_CACHE_MAX_SIZE=12Ginhosts/linux/rex.nix(systemd.user.sessionVariables). The session reads it when it starts: log in again or reboot after a change. - Default Proton: Steam's default compatibility tool is
proton-cachyos-slr(Settings → Compatibility, orCompatToolMapping"0"in~/.local/share/Steam/config/config.vdfwhile Steam is closed). - Launch options:
game-performance %command%(performance power profile while the game runs). AddPROTON_FSR4_UPGRADE=1in front for FSR4 on this RDNA4 card (Proton games only; native Linux games such as Dota 2 ignore it), andmangohudfor an overlay. - No gamemode: ananicy-cpp runs, and the two conflict. The single-CCD X3D CPU needs no core parking.
- GPU: Vulkan lists the RX 9070 XT first and the iGPU second, so nothing is pinned. Check with
vulkaninfo --summary.
A Windows machine gets omp, Tern and SSH from this Mac, over SSH: just win-sync <name> <user>@<ip> renders a bundle from the repo and the vault, copies it to the host and applies it there with PowerShell (hosts/windows/apply.ps1). Nothing on Windows runs it on a schedule: sync again after a change.
- Host.
hosts/windows/<name>/:winget.txt(packages),mcp-overrides.json(the MCP servers to drop or replace) andssh-hosts.txt(theprograms.sshaliases that its~/.ssh/configgets). - What it sets up. The winget packages (installed when missing, never upgraded or removed:
winget upgrade --all). omp'sconfig.yml,models.ymlandmcp.json(with the host's overrides,${HOME}turned into${USERPROFILE}),~/.omp/.env(OMP_ENVof the vault), the captured plugins (bun install --frozen-lockfile, when the manifests change) and the skills library (picked as vm-sync picks it). Tern'ssettings.jsonand its host list: the Mac's own Tern host list, read at sync time (so no address enters the repo), without the Windows host itself, plus this Mac by its endpoint id (reached through Tern's relay, from any network); the host keys are the ones the Mac pinned (an endpoint id needs none: the id is the key).~/.ssh/configand the host's own SSH key. - Files. Written the way the VMs' writable copies are: a file edited on Windows stays until the repo copy changes, and is then kept as
<file>.dotfiles-backup.~/.omp/.envand the key are readable by the user and SYSTEM only. - Its SSH key. Made by the first sync and kept in the infra vault map
WIN_SSH_KEYS, so a reinstall gets the same key back.just win-authorize <name> <user>@<ip>adds its public half to~/.ssh/authorized_keys: on each host ofssh-hosts.txtand of the Mac's Tern host list (through the Mac's own login there, once per user and host), on this Mac itself, and in the gh account forgithub.1485827954.workers.dev. Tern's remote service reads the same file. Nothing is ever removed. - Check.
just win-check <name> <user>@<ip>reports drift, exits 1 on any, and changes nothing. - Host key. The host's SSH host key must be pinned in the Mac's
~/.ssh/known_hosts: win-sync sends secrets, so it never trusts a key on first use.
-
On the host: install Tern by hand (it brings its own omp, in
%LOCALAPPDATA%\Tern\omp). -
On the host, in an admin PowerShell: the OpenSSH server, logins with the Mac's key only (an administrator's keys are read from
administrators_authorized_keys, never~\.ssh), PowerShell as the login shell, port 22 open on Private networks only:Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0 Start-Service sshd; Set-Service sshd -StartupType Automatic Set-Content -Encoding ascii C:\ProgramData\ssh\administrators_authorized_keys '<the Mac public key line>' icacls C:\ProgramData\ssh\administrators_authorized_keys /inheritance:r /grant "*S-1-5-32-544:F" /grant "*S-1-5-18:F" New-ItemProperty -Path HKLM:\SOFTWARE\OpenSSH -Name DefaultShell -Value C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -PropertyType String -Force Set-NetConnectionProfile -InterfaceAlias Ethernet -NetworkCategory Private Set-NetFirewallRule -Name OpenSSH-Server-In-TCP -Profile Private
Windows can add a second rule,
sshd, open on every network:Disable-NetFirewallRule -Name sshd. Then, inC:\ProgramData\ssh\sshd_config, setPasswordAuthentication noandKbdInteractiveAuthentication noabove theMatch Group administratorsblock, check withsshd -t, andRestart-Service sshd. -
On the Mac, pin its host key: print the fingerprint at the host (
ssh-keygen -lf C:\ProgramData\ssh\ssh_host_ed25519_key.pub), thenssh-keygen -R <ip>, connect once withssh -o StrictHostKeyChecking=ask <user>@<ip>, and compare the two. -
Copy
hosts/windows/rex/tohosts/windows/<name>/and edit its lists. -
just win-sync <name> <user>@<ip>, thenjust win-authorize <name> <user>@<ip>. GitHub needs a scope the default gh login does not have; once:gh auth refresh -h github.com -s admin:public_key. -
Tern's remote service, so the Mac (and the host's own list) can open sessions on it: from the Mac,
tern remote setup <user>@<ip>. It adds a per-user Run key (tern.exe remote serve --user), so the service starts when the user logs in. It opens no port: on the host, in an admin PowerShell,New-NetFirewallRule -Name tern-remote-udp -DisplayName "Tern remote (UDP 8376)" -Direction Inbound -Protocol UDP -LocalPort 8376 -Program "$env:LOCALAPPDATA\Programs\Tern\tern.exe" -Profile Private -Action Allow, then run setup again. After a reinstall, first remove the host's old pins (its<ip>:8376and old endpoint id lines) from the Mac's Ternknown_hosts.
- omp is Tern's own copy, updated by Tern; this repo does not manage it.
- MCP servers: zennotes, open-design and unsplash are left out (Mac apps and paths), and playwright too: with
browser.enabled(omp's own browser tool), omp skips browser MCP servers on every machine. codegraph runs through npx; chrome-devtools uses the Chrome ofwinget.txt. reactive-resume needs its OAuth sign-in once per machine. - Not synced: omp's extensions (rtk, env-reload, herdr's), the Tern plugins (macOS only) and the Mac's other SSH keys.
- Tern hosts on the office networks need Cloudflare WARP on the Windows host, logged in to the same team as the Mac. A host the Mac drops from its list stays in the Windows host's list (the sync never removes one).
- From a Tern pane on the home LAN,
secretspeccan fail withNo route to hostwhile the Mac's ownsshstill works: macOS's Local Network privacy, which does not limit Apple's tools. Run the recipe in Terminal.app. - Rollback: a file the sync replaced is kept as
<file>.dotfiles-backup; a package goes withwinget uninstall --id <id>; the key goes from each host'sauthorized_keys(this Mac's too), from GitHub (titled<name> (Windows)) and fromWIN_SSH_KEYS.
NixOS guests on Proxmox, provisioned with Terragrunt + OpenTofu (bpg/proxmox) and installed with nixos-anywhere.
- Roles. Each VM entry picks a role:
clean(the default: the generic guesthosts/nixos/proxmox-guest,nixosConfigurations.proxmox-guest) oragent(the same guest plus theagent-devmodule,nixosConfigurations.proxmox-agent). See Roles. - Identity is fixed at install.
vm-installwrites the hostname, the static network file and root's SSH keys onto the new system from the VM's entry in the vault. NixOS runs no cloud-init at all: the Proxmox cloud-init drive only serves the Debian bootstrap stage and is ignored afterwards. See Identity: fixed at install. - Disk. The root disk is LUKS2 and every boot waits for its passphrase. See Disk encryption and unlock.
- Access. Root login by key only, and no QEMU guest agent: the VM has no command channel from Proxmox into the guest, and nothing on it reads the cloud-init drive.
- Users. The clean role has no other user and no Home Manager. The agent role adds one login user without sudo (see Roles).
The repo holds no server value of this stack, not even in docs or comments. There is one exception, accepted by the author: home/ssh/jumphost.nix holds the jumphost's IPv4 address and its SSH host public key, so that the agent VM can pin the jumphost. The Mac's ssh config (home/default.nix) reads the same file, so the address is also in the Mac's ~/.ssh/config.
The rule does not cover the addresses of the Mac's other ssh hosts (home/default.nix) or of services in home/omp/models.yml, and nothing checks them.
just infra-leak-check scans tracked file contents. It catches:
- the Proxmox endpoint host, token id and secret;
- the state passphrase;
- the S3 endpoint host and the S3 secret key;
- every VM LUKS passphrase;
- the Hindsight host and key of every VM;
- every VM name, IPv4, MAC and gateway.
It does not catch these; they stay with the author:
- the S3 access key id (it equals the project name);
- the jumphost's address and host key (above);
- the bucket, node, datastore and bridge names, vmids, sizing and DNS resolvers;
- the initrd host public keys (public by design);
- tracked path names, commit messages and git history.
Placeholders used below: <endpoint>, <bucket>, <name>, <ipv4>, <vmid>, <node>, <user> (the agent VM's login user), <image-datastore>, <vm-datastore>, <bridge>, <role>, <tokenid>, <project>.
- Repo:
infra/(Terragrunt unitinfra/proxmox/vms,infra/root.hcl,infra/secretspec.toml= key names only),hosts/nixos/proxmox-guest/(role clean),modules/nixos/agent-dev.nixwithmodules/nixos/agent-dev/omp.nixandhome/linux/(role agent). - OpenBao: the
dotfiles-infraproject,secret/secretspec/dotfiles-infra/default/<KEY>. The keys:TF_VAR_proxmox_endpoint,TF_VAR_proxmox_api_token(fulluser@realm!id=secretform),TF_VAR_proxmox_insecure.TF_VAR_image_datastore,TF_VAR_vm_datastore,TF_VAR_network_bridge.TF_VAR_vms.TF_VAR_ssh_authorized_keys(a reference toSSH_ID_ED25519_PUBof the root manifest, one copy).TF_VAR_tofu_state_passphrase.AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY(the dedicated S3 state user; the OpenTofu s3 backend reads both from the environment).TF_STATE_S3_ENDPOINT(http://<endpoint>:<port>),TF_STATE_S3_BUCKET.- Two JSON maps keyed by VM name that
vm-installmaintains:VM_LUKS_KEYS(the disk passphrase of each VM) andVM_INITRD_HOST_KEYS(the public key of each VM's initrd SSH host key). Seed both once with{}(printf '{}' | secretspec set VM_LUKS_KEYS, same forVM_INITRD_HOST_KEYS, withSECRETSPEC_FILE=infra/secretspec.toml SECRETSPEC_REASON="dotfiles infra"exported). Both keys are required, soinfra-planand the leak check fail until they exist. - A third JSON map is optional and written by hand:
VM_HINDSIGHT(VM name to the public Hindsight URL and that VM's API key; the manifest default is{}). See Hindsight. - Every key of a new vault: Seed a new vault.
- State: the S3 bucket
<bucket>on the RustFS at<endpoint>, keydotfiles-infra/proxmox-vms/terraform.tfstate.- The object is encrypted client-side (AES-GCM, key from
TF_VAR_tofu_state_passphrase, which stays in OpenBao). Its envelope keepslineage,serialand key-derivation metadata in clear, and a lock object is plain JSON that namesuser@hostand the path. - Terragrunt writes the generated backend file and the
.terraformcache underinfra/proxmox/vms/.terragrunt-cache/(gitignored; no state, but they name the endpoint and bucket). - Locking is the s3 backend's native lockfile (
use_lockfile), verified on this RustFS: a second run while one is active fails with a state-lock error. - The unit fails early, naming the variable, when
TF_STATE_S3_ENDPOINTorTF_STATE_S3_BUCKETis empty.
- The object is encrypted client-side (AES-GCM, key from
These rules hold for every secretspec command in the sections below.
- Export
SECRETSPEC_FILE=infra/secretspec.toml SECRETSPEC_REASON="dotfiles infra"first. This is the "same exported environment" that later recipes refer to.SECRETSPEC_REASONis needed in agent sessions. secretspec setreads the value from stdin when it is piped, and drops one trailing newline (measured). Never pass the value as an argument: it would land in shell history. Pasting multi-line JSON into the interactive prompt is unverified.secretspec getends its output with a newline, so agetpiped into asetcomes back unchanged (measured).- Never run
secretspec getwith its output on the terminal. Pipe it, or redirect it to a private file: a pipe keeps the old map off the terminal. - The default provider of
~/.config/secretspec/config.tomlis theopenbaoalias. If yours differs, add-p openbao.
First do New machine: just openbao-login, then just home (or just switch). That brings:
- the tools this stack runs:
terragrunt,opentofu,bao,rsyncandaws(secretspecis the cargo binary of New machine step 2;jq,opensslandsshcome with macOS); - the SSH key
~/.ssh/id_ed25519, written from the vault, which logs in to the VMs.
Nothing else is seeded locally. Any Mac that did this and can reach everything below can plan, apply, vm-install and vm-deploy (they read addresses from the state). They fail while the state store is unreachable.
LAN, VPN or WARP, whatever your network needs:
- OpenBao,
https://openbao.home.0dl.me: every recipe. - The Proxmox API,
<endpoint>on TCP 8006: plan and apply. - The state store,
<endpoint>:<port>of the RustFS: every recipe that reads the state (plan, apply,vm-install,vm-deploy,vm-unlock,vm-vault-tunnel). - The VM: TCP 22 (ssh,
vm-install,vm-deploy,vm-sync,vm-vault-tunnel), TCP 2222 while it waits in the initrd (vm-unlock), UDP 8376 for Tern (role agent). - The jumphost: TCP 22, through the Mac's ssh entry
jumphost_server(vm-jumphost-authorize). - The public Hindsight URL: HTTPS (
vm-syncchecks/healthwith the VM's key before it writes anything).
The VM itself needs outbound HTTPS (the Nix binary cache, GitHub, npm, the Hindsight URL) and, for the Docker context and the shell, TCP 22 to the jumphost. Each Proxmox node needs outbound HTTPS to cloud.debian.org (see Proxmox side).
Run just infra-leak-check. It expects no leaks, reads OpenBao and scans tracked files for the real values. just test-infra tests the check itself.
Do these once per RustFS, Proxmox cluster or vault. Routine work is under VM operations.
Once per RustFS. This section is the only record of these steps outside IaC.
The user MUST be named dotfiles-infra and the policy dotfiles-infra-state: the leak check skips the access key id only because it equals the project name. This repo installs aws (awscli2) but not mc, so run the mc lines inside nix shell nixpkgs#minio-client.
-
Put the root credentials into variables, never typed into a command line (bash or zsh). Never
mc alias set: it writes the root credentials to~/.mc/config.json. Where the root credentials are kept: The RustFS root credentials.export MC_CONFIG_DIR=$(mktemp -d) # without this mc creates ~/.mc read -r RUSTFS_ROOT_USER # the RustFS root credentials are kept with the stack that deploys the RustFS read -rs RUSTFS_ROOT_SECRET # not echoed, not in history export MC_HOST_<alias>="http://$RUSTFS_ROOT_USER:$RUSTFS_ROOT_SECRET@<endpoint>:<port>" # URL-encode special characters unset RUSTFS_ROOT_USER RUSTFS_ROOT_SECRET
-
Save this policy as
policy.jsonoutside the repo.DeleteObjectis needed to release the lock.- The prefix condition on
ListBucketdenies the backend's workspace-list call, which it ignores on purpose. GetBucketLocationonly reveals the region and is whatmcasks for.
{ "Version": "2012-10-17", "Statement": [ {"Effect": "Allow", "Action": ["s3:GetObject", "s3:PutObject", "s3:DeleteObject"], "Resource": ["arn:aws:s3:::<bucket>/dotfiles-infra/*"]}, {"Effect": "Allow", "Action": ["s3:ListBucket"], "Resource": ["arn:aws:s3:::<bucket>"], "Condition": {"StringLike": {"s3:prefix": ["dotfiles-infra/*"]}}}, {"Effect": "Allow", "Action": ["s3:GetBucketLocation"], "Resource": ["arn:aws:s3:::<bucket>"]} ] } -
Create, from the repo root. The secret goes to the vault before it goes to the RustFS, so it cannot be lost. There is exactly one secret here (
$sec); the root credentials areRUSTFS_ROOT_*.mc admin user addtakes the secret as an argument, so it shows in the process list while it runs, not in shell history (history holds"$sec").export SECRETSPEC_FILE=infra/secretspec.toml SECRETSPEC_REASON="dotfiles infra" mc mb --ignore-existing <alias>/<bucket> # a fresh RustFS needs the bucket first mc admin policy create <alias> dotfiles-infra-state policy.json sec=$(openssl rand -hex 24) printf '%s' "$sec" | secretspec set AWS_SECRET_ACCESS_KEY printf '%s' dotfiles-infra | secretspec set AWS_ACCESS_KEY_ID mc admin user add <alias> dotfiles-infra "$sec" # the secret shows in the process list while this runs, not in shell history (history holds "$sec") mc admin policy attach <alias> dotfiles-infra-state --user dotfiles-infra unset sec printf '%s' 'http://<endpoint>:<port>' | secretspec set TF_STATE_S3_ENDPOINT # not secrets, but they land in shell history printf '%s' '<bucket>' | secretspec set TF_STATE_S3_BUCKET
-
Verify (a wrong policy shows up here, not in the middle of an apply). The two put/delete lines must succeed and the list outside the prefix must say AccessDenied. Then
just infra-planmust end without an error.secretspec run -- sh -c ' export AWS_DEFAULT_REGION=us-east-1 awsr() { aws --endpoint-url "$TF_STATE_S3_ENDPOINT" "$@"; } x="s3://$TF_STATE_S3_BUCKET/dotfiles-infra/_probe/x" printf x | awsr s3 cp - "$x" && awsr s3 rm "$x" awsr s3api list-objects-v2 --bucket "$TF_STATE_S3_BUCKET" --prefix other/ '
Same order, vault first. Measured: the old secret is refused at once, so runs fail between the two commands; do not rotate during an apply.
sec=$(openssl rand -hex 24)
printf '%s' "$sec" | secretspec set AWS_SECRET_ACCESS_KEY
mc admin user add <alias> dotfiles-infra "$sec" # on an existing user this replaces the secret
unset secDetach, remove the user, remove the policy, then delete the four keys from the dotfiles-infra OpenBao project. State objects stay in the bucket until you delete them.
mc admin policy detach <alias> dotfiles-infra-state --user dotfiles-infra
mc admin user remove <alias> dotfiles-infra
mc admin policy remove <alias> dotfiles-infra-stateOnce per cluster, by hand. The stack changes nothing on the hosts, and it needs no SSH to a node: the provider has no ssh block, and the image download and the disk import go through the API. Measured on PVE 9.1.4 with bpg/proxmox 0.112.0.
TF_VAR_image_datastoreis a directory datastore with the content typeimport(the Debian image lands there).TF_VAR_vm_datastorehasimages(an LVM-thin datastore does), for the VMs' disks and their cloud-init drives.pvesm set <datastore> --content <list>replaces the whole list; it does not add to it. So read the current list first and repeat it with the new type:grep -A8 '^dir: <image-datastore>' /etc/pve/storage.cfgon a node, thenpvesm set <image-datastore> --content <current types>,import.pvesm status --content importlists the datastores that acceptimport.
- Each
nodeinTF_VAR_vmsis a cluster node name, andTF_VAR_network_bridgeis a bridge of that name on every such node. - The VM gets one NIC on it, untagged (the stack sets no VLAN), with the static address of its entry. The bridge must carry that subnet and reach the gateway. Nothing uses DHCP.
- A VM is created through the cluster. With no quorum Proxmox answers
HTTP 500 ... cluster not ready - no quorum?and the apply fails. - It did once, with the second node of a two-node cluster down: the image was downloaded and saved in the state, the VM was not created, and a later apply created only the VM.
- Bring the node back.
pvecm expected 1on the online node tells corosync to expect one vote, which lets a single node go on. It splits the cluster if the other node is only cut off, not down. It was not used here.
Each node needs outbound HTTPS to cloud.debian.org: the node downloads the image itself, the Mac does not. On a node, curl -fsSI <url from infra/proxmox/vms/main.tf> must print a 200.
The stack uses the token to create, change, stop and delete VMs, to download the Debian image into the image datastore and import it as a disk, and to read the cluster.
Measured read-only with the token itself (GET /access/users/<user>@<realm>/token/<tokenid> and GET /access/permissions), the current token:
- belongs to the built-in
root@pamuser; - has privilege separation off (
privsepis 0, so it carries everything its user has); - never expires;
- holds every privilege (47 on PVE 9.1.4) on
/.
That is far more than the stack needs. It is also not this stack's own token: it is the token of another stack, copied once into this vault together with the endpoint. Rotating or deleting it means updating both vaults.
This comes from the PVE API reference of the installed 9.1 and the bpg/proxmox 0.112.0 docs. It was not tried on a real token: create one, run just infra-plan and an apply of a throwaway VM, and add what a 403 names.
| Privileges | Used for | ACL path |
|---|---|---|
VM.Allocate, VM.Audit, VM.PowerMgmt, VM.Config.CPU, VM.Config.Memory, VM.Config.Disk, VM.Config.Network, VM.Config.HWType, VM.Config.Options, VM.Config.Cloudinit |
create, read, change, stop and delete a VM | /vms |
Datastore.Audit, Datastore.AllocateSpace |
the VM's disk and cloud-init drive | /storage/<vm-datastore> |
Datastore.Audit, Datastore.AllocateSpace, Datastore.AllocateTemplate, Datastore.Allocate |
download the image, import it as a disk, delete it with the last VM of a node | /storage/<image-datastore> |
SDN.Use |
attach the NIC to the bridge | /sdn/zones/localnetwork, the zone of local bridges (the path is from Proxmox forum reports; the manual does not name it) |
Sys.Audit, Sys.AccessNetwork |
read the node; the download (the 9.1 API reference wants Sys.AccessNetwork on the node, or Sys.Audit and Sys.Modify on /, which is the pair the bpg docs name) |
/nodes/<node>, for each node that holds a VM |
To create such a token on a fresh Proxmox, run these as root on a node.
- The commands were checked against the
pveumman page that the installed Proxmox serves (/pve-docs/pveum.1.html, version 9.1.2); none was run. - The one role at every path is a convenience: a privilege that means nothing at a path does nothing there.
- With
--privsep 1(the default) the token has its own ACL and never more than its user, so the role goes to both, as the loop does. - With
--privsep 0the token carries its user's permissions and the--tokensline is not needed (the current token is of that kind).
pveum user add <user>@pve --comment "dotfiles infra" # no password: it cannot log in
pveum role add <role> --privs "VM.Allocate, VM.Audit, VM.PowerMgmt, VM.Config.CPU, VM.Config.Memory, VM.Config.Disk, VM.Config.Network, VM.Config.HWType, VM.Config.Options, VM.Config.Cloudinit, Datastore.Audit, Datastore.AllocateSpace, Datastore.AllocateTemplate, Datastore.Allocate, SDN.Use, Sys.Audit, Sys.AccessNetwork"
pveum user token add <user>@pve <tokenid> --privsep 1 # prints the full token id and the secret, once
for p in /vms /storage/<image-datastore> /storage/<vm-datastore> /sdn/zones/localnetwork /nodes/<node>; do
pveum acl modify "$p" --users <user>@pve --roles <role>
pveum acl modify "$p" --tokens '<user>@pve!<tokenid>' --roles <role>
done
pveum user token permissions <user>@pve <tokenid> # what the token can do nowThe vault string is <user>@pve!<tokenid>=<secret>: join the full token id and the secret with = (see Seed a new vault).
Once; skip every key that already exists. The rules for secretspec commands are under secretspec conventions. The five plain values (endpoint, insecure flag, two datastores, bridge) are not secrets, but they land in shell history.
export SECRETSPEC_FILE=infra/secretspec.toml SECRETSPEC_REASON="dotfiles infra"
printf '%s' 'https://<endpoint>:8006/' | secretspec set TF_VAR_proxmox_endpoint
printf '%s' 'true' | secretspec set TF_VAR_proxmox_insecure # skips TLS verification of the Proxmox API: true while the Mac does not trust its certificate (Proxmox signs its own by default)
printf '%s' '<image-datastore>' | secretspec set TF_VAR_image_datastore
printf '%s' '<vm-datastore>' | secretspec set TF_VAR_vm_datastore
printf '%s' '<bridge>' | secretspec set TF_VAR_network_bridge
pbpaste | secretspec set TF_VAR_proxmox_api_token # the full <user>@<realm>!<tokenid>=<secret> string, from the clipboard
openssl rand -hex 32 | secretspec set TF_VAR_tofu_state_passphrase # 64 characters, never shown; OpenTofu's pbkdf2 key provider needs at least 16
printf '{}' | secretspec set VM_LUKS_KEYS
printf '{}' | secretspec set VM_INITRD_HOST_KEYS- The passphrase line is for a new vault with no state object only: a new passphrase makes an existing state object and its backups unreadable.
TF_VAR_ssh_authorized_keysneeds no command: it readsSSH_ID_ED25519_PUBof the root manifest (see Secrets).VM_HINDSIGHTis optional (see Hindsight).
For the first TF_VAR_vms, use this form: the pipe form under Add a VM starts with secretspec get, so it cannot create the key. vmid is a number, role is left out for clean, and 4, 8192 and 64 are the size the agent VM was proven with:
jq -n --arg n '<name>' '{($n): {node: "<node>", vmid: 0, mac: "<mac>", ipv4_cidr: "<ipv4>/<prefix>", gateway: "<gateway>", dns: ["<resolver>"], cores: 4, memory_mb: 8192, disk_gb: 64, role: "agent"}}' | secretspec set TF_VAR_vmsThe four S3 keys come from Provision the state user. The RustFS root credentials that step needs are not in this project. They are the keys TF_VAR_rustfs_root_user and TF_VAR_rustfs_root_password of the secretspec project of the stack that deploys the RustFS, at secret/secretspec/<project>/default/<KEY>, field value (<project> is the [project] name of that stack's secretspec.toml).
Read them into the variables of step 1 there. bao kv get -field puts the value into the variable, not onto the terminal:
export BAO_ADDR=https://openbao.home.0dl.me
RUSTFS_ROOT_USER=$(bao kv get -mount=secret -field=value secretspec/<project>/default/TF_VAR_rustfs_root_user)
RUSTFS_ROOT_SECRET=$(bao kv get -mount=secret -field=value secretspec/<project>/default/TF_VAR_rustfs_root_password)- Check that
<ipv4>and<mac>are not used by another host or guest: ping the address and look through the Proxmox guest configs (/etc/pve/qemu-server/and/etc/pve/lxc/on every node). - Set
TF_VAR_vms, a JSON map keyed by VM name. Keep the existing entries and add the new one: the pipe form below does that, and on a vault withoutTF_VAR_vmssee The first VM entry. The JSON shows the shape. - Run the recipes in the second block below.
The fields of an entry:
- Name: a DNS label of 4 to 63 characters that is not a word used elsewhere in this repo. It becomes the hostname.
- Size: nixos-anywhere's kexec needs at least 1.5 GB of RAM (its
docs/requirements.md), so usememory_mbof at least 2048. The first VM used 4096 MB and 32 GB of disk; the agent role was proven with 4 cores, 8192 MB and 64 GB. roleis optional:cleanwhen it is left out (see Roles).
{
"<name>": {
"node": "<node>", "vmid": 0, "mac": "<mac>",
"ipv4_cidr": "<ipv4>/<prefix>", "gateway": "<gateway>", "dns": ["<resolver>"],
"cores": 0, "memory_mb": 0, "disk_gb": 0, "role": "agent"
}
}export SECRETSPEC_FILE=infra/secretspec.toml SECRETSPEC_REASON="dotfiles infra"
secretspec get TF_VAR_vms | jq -c '. + {"<name>": {"node": "<node>", "vmid": 0, "mac": "<mac>", "ipv4_cidr": "<ipv4>/<prefix>", "gateway": "<gateway>", "dns": ["<resolver>"], "cores": 0, "memory_mb": 0, "disk_gb": 0}}' | secretspec set TF_VAR_vms
just infra-leak-check # a name that collides with a word in this repo shows up here, before any VM exists
just infra-plan # must show exactly the new entries
just infra-apply
just vm-install <name> # wait until the VM has booted; Debian cloud image → NixOS with an encrypted root, via nixos-anywhere
just vm-unlock <name> # the VM now waits for its disk passphrase in the initrd; this sends it and waits for SSH on port 22Notes:
- Names,
vmid,macand address must be unique across entries. The unit rejects collisions, but only insideTF_VAR_vms. vm-installrefuses unlessdebian@<ipv4>accepts the login, so an installed VM is never reformatted. Wait for the VM to boot before running it.- That login only proves the key is accepted, so the free address and MAC check in step 1 is yours.
- Before it formats anything,
vm-installgenerates the disk passphrase (first install of that name only) and a fresh initrd SSH host key, and stores both in OpenBao (see Disk encryption and unlock). - The
secretspecrules (stdin,SECRETSPEC_REASON) are under secretspec conventions.
- Change
coresormemory_mbin itsTF_VAR_vmsentry (the pipe form above). - Back up the state object first (see Back up the state object).
- Run
just infra-plan(one in-place update) andjust infra-apply. - Run
just vm-unlock <name>.
The provider reboots the VM during the apply (measured with bpg/proxmox 0.112.0: about 4 s, no pending change left). Running sessions and containers on the VM stop, and the VM then waits in the initrd, hence step 4.
A larger disk_gb enlarges the virtual disk only. To make the root use it, see Grow the disk.
disk_gb is the whole size in GB, not an increment, and it only grows: the provider refuses a smaller value. Measured with bpg/proxmox 0.112.0, 64 to 84 on two agent VMs at once: no reboot, no unlock, nothing stopped.
-
Back up the state object first (see Back up the state object).
-
Set the new size, with the exported environment of secretspec conventions:
secretspec get TF_VAR_vms | jq -c '.["<name>"].disk_gb = <gb>' | secretspec set TF_VAR_vms
-
Run
just infra-plan. It must show onlysize = <old> -> <gb>in that VM'sdiskblock. Then runjust infra-apply.- The provider grows the disk through the Proxmox resize call while the VM runs (about 4 s). No reboot follows and no pending change is left.
- The VM's kernel logs
sda: detected capacity changeandlsblkshows the new size at once.
-
Grow partition 3, the LUKS mapping and the ext4 root, on the running VM, as root:
ssh root@<ipv4> 'sfdisk -d /dev/sda >/root/sda-before-grow.sfdisk && nix shell nixpkgs#cloud-utils -c growpart /dev/sda 3' secretspec get VM_LUKS_KEYS | jq -je '.["<name>"]' | ssh root@<ipv4> 'cryptsetup resize cryptroot --key-file=- && resize2fs /dev/mapper/cryptroot && df -h /'
- The first line keeps the old partition table on the VM.
growpartis not installed:nix shelltakes it from the VM's pinned nixpkgs. It keeps the start of the partition, moves the end to the end of the disk and moves the backup GPT header there.growpart --dry-run /dev/sda 3shows the new table without writing it. cryptsetup resizeasks for the passphrase even for the open mapping (without one it fails withNothing to read on input). The passphrase goes over stdin, without a newline (jq -j), asvm-installwrote it. It is never printed.resize2fsgrows the mounted file system.- The LUKS2 header gives the data segment the length
(whole device), so the next boot opens the whole partition with no other step.
- The first line keeps the old partition table on the VM.
- Remove its key with
secretspec get TF_VAR_vms | jq -c 'del(.["<name>"])' | secretspec set TF_VAR_vms(same exported environment as in secretspec conventions). just infra-plan: it must show exactly that VM's destroy.just infra-apply.- Delete its entries from the two maps the same way (
secretspec get VM_LUKS_KEYS | jq -c 'del(.["<name>"])' | secretspec set VM_LUKS_KEYS, andVM_INITRD_HOST_KEYS). The passphrase of a destroyed disk is useless.
Removing the last VM on a node also destroys that node's downloaded Debian image. Renaming a key is a destroy plus a create: the name is the for_each key and the hostname.
Edit hosts/nixos/proxmox-guest/ (both roles share it), modules/nixos/agent-dev.nix or home/linux/ (agent), then run just vm-deploy <name>.
vm-deployrunsnixos-rebuild switchover SSH as root, built on the VM. It prints which configuration the VM gets.- A new kernel or initrd takes effect at the next boot, and every boot waits for
just vm-unlock <name>. vm-deploynever rewrites the identity files or the initrd's address: they are written at install.
vm-deployrunsnixos-rebuild-ng switch --flake .#<config>in the checkout that holds thejustfile(infra/vm-deploy.sh).vm-installpasses--flake <that checkout>#<config>tonixos-anywhere(infra/vm-install.sh).- Both evaluate the git working tree of that directory: tracked files with uncommitted edits are deployed (an edited
home/omp/config.ymlormodels.ymlreaches the VM), and untracked files are not seen (measured with the git fetcher that flakes use). - So commit or stash before a deploy. Otherwise the VM runs a state that no commit holds, and a rebuild from a clone cannot reproduce it. A clone also has only what was pushed.
The pin is in infra/proxmox/vms/main.tf: local.debian_image.url, local.debian_image.sha512 and the file_name of proxmox_download_file.debian.
- The file name must equal the last part of the URL (the datastore keeps the volume under that name).
- Pick a dated directory under
https://cloud.debian.org/images/cloud/trixie/(<date>-<build>/, notlatest/). - Take the sha512 of the file from the
SHA512SUMSof that directory (one line,<sha512> <file name>):
curl -fsSL https://cloud.debian.org/images/cloud/trixie/<date>-<build>/SHA512SUMS | grep ' debian-13-genericcloud-amd64-<date>-<build>.qcow2$'Then run just infra-plan. No VM may change, because the VMs ignore import_from (lifecycle.ignore_changes), so a new image only serves VMs created afterwards. What the plan says about the image resource itself (replace or update in place) was not exercised.
- Create the new token in Proxmox (Create a least-privilege token has the commands).
- Copy the full
<user>@<realm>!<tokenid>=<secret>string to the clipboard. - Run
pbpaste | secretspec set TF_VAR_proxmox_api_token(same exported environment as in secretspec conventions).
Without this the next plan fails with 401.
The current token is also the token of another stack: deleting it in Proxmox, or making a new secret for it, breaks that stack too, so update its vault in the same step. A token of its own for this stack ends the sharing.
The optional role field of a TF_VAR_vms entry picks the NixOS configuration. Leaving it out means clean.
variables.tfrefuses any other value at plan time.vm-installandvm-deploybuild.#proxmox-guestforcleanand.#proxmox-agentforagent(infra/vm-config.sh).just test-rolesevaluates both and fails when the clean guest gains a user, a port or an agent package.- A role changes no Proxmox resource.
just infra-planshows a flip only as a change to thevmsoutput (role = "clean" -> "agent"), and the deploy reads the role from the vault, not from the state, so noinfra-applyhas to come first. - A deploy prints which configuration the VM gets. Re-seeding
TF_VAR_vmsfrom an older value without the role silently meansclean, which removes the agent user at the next deploy. - A different
cores,memory_mbordisk_gbis an in-place update of the Proxmox VM (measured:1 to change), and the LUKS root does not follow a bigger disk (see Disk encryption and unlock). So a resize with a new role is a reinstall: the recipe under Reinstall (-replace,vm-install,vm-unlock).
Save a copy of the map to a private file first, and check that the name exists (a mistyped name would add a stub entry). Then run this (same exported environment as in secretspec conventions):
umask 077; secretspec get TF_VAR_vms > <private file> && jq -e --arg n "<name>" 'has($n)' <private file> >/dev/null && jq -c --arg n "<name>" '.[$n].role = "agent"' <private file> | secretspec set TF_VAR_vms
nixosModules.agent-dev has these options:
dotfiles.agent.enable;.omp,.mise,.tern,.gh,.mason,.podman,.docker,.jumphost,.tools,.vault,.caBundle,.zsh,.browserand.blender, each with.enable, each on when the agent is;.sync.hindsight,.sync.pluginsand.sync.skills(see Personal setup), each on when the agent is;dotfiles.agent.user, defaultlex.
What the agent role gives the VM:
- A login user outside
wheelwith no sudo (root still logs in by key), zsh, andlingerso that its user services start at boot. - Home Manager (
home/linux/agent.nix, not the Mac'shome/default.nix): zsh, starship, git with the Mac's identity, direnv with nix-direnv, mise. programs.nix-ld, so that glibc programs that were not built for NixOS run (mise's runtimes, omp, Tern).- omp,
gh, rootless podman and rootless Docker,just,lazygit,lazydocker,tokei,btop,kubectl,k9s,superfile,zoxide,bao,secretspec, a headless Chromium behind/opt/google/chrome/chromefor the browser tools, Blender under a headless Wayland compositor for the Blender MCP addon, zram swap,curl,gccandgnumake. - zsh with the Mac's aliases, options, keybindings and plugins.
The Home Manager input is home-manager-nixos (release-25.11, following nixpkgs-nixos). The home-manager input is master and does not evaluate against nixos-25.11 (it needs nixpkgs-unstable's lib/services/lib.nix).
proxmox-guest is untouched: its toplevel derivation is byte-identical with and without this module in the flake.
- The user logs in with the same keys as root.
- An activation script copies
/root/.ssh/authorized_keys, whichvm-installwrote, to the root-owned/etc/ssh/agent-authorized-keysat every activation. sshd reads that file for every account (services.openssh.authorizedKeysFiles). - Root's list stays the one list (a key removed there is gone for the user at the next deploy or reboot). Root writes nothing inside the user's home, and no key is in the repo or the Nix store.
- The user's own
~/.ssh/authorized_keysstays the user's.tern remote setupcreates it and adds the Mac's Tern device key (which lets that key log in over SSH as the user too), and keys the user adds there stay across deploys and reboots.
omp update works on the VM, as on the Mac.
- The pin is
modules/nixos/agent-dev/omp.nix(the GitHub release asset ofcan1357/oh-my-pi, version18.8.7). It is a Bun-compiled binary, so nothing may strip or patch it; it runs through nix-ld. - The pinned package stays on the system PATH as the fallback. Home Manager copies the same binary once to
~/.local/bin/omp(home/linux/seed-user-binary.sh, a step afterwriteBoundary): a regular file of the user's, mode 755, which comes before the Nix profile directories on every zsh'sPATH. omp updaterefuses to run from the Nix store (it replaces its own file, and the store is read-only), but it replaces this copy. It downloads the release asset, checks its size and sha256, writes a new file beside the old one and swaps it in with renames. Measured on the VM, 18.8.7 to 18.8.9: the new file's sha256 was the release's, and no.bakor.newfile stayed.- So you update omp on the VM, with
omp update(omp update --checkonly looks). - A shell that already ran
ompbefore this was deployed has the store path in its command hash:hash -r, or open a new shell.
- The copy is made only when
~/.local/bin/ompis missing or a symlink. A symlink is replaced by a copy, and the step says what it pointed to; a symlink to a directory is left alone. - A regular file is never replaced, so neither
just vm-deploynor a reboot (Home Manager activates at every boot) downgrades an omp that you updated. Measured: a deploy after anomp updateto 18.8.9, with the pin at 18.8.7, left the file's inode, mtime and sha256 as they were. - A newer pin in the repo does not reach a VM that has its own copy. The pin only decides what a new install, or a VM whose copy was deleted, starts with.
- The copy is written to a temporary file in
~/.local/binand renamed over the target, so nothing reads half a program.
On the VM: rm ~/.local/bin/omp, then just vm-deploy <name> on the Mac (or reboot the VM: the next activation makes the copy). Until then omp is the store fallback.
This only changes the seed. Change version and hash together, then just vm-deploy <name>.
nix store prefetch-file --json <release asset URL>prints the hash.- Compare it with the digest the release page lists for the asset:
gh release view v<version> --repo can1357/oh-my-pi --json assets.
- omp's config (
home/omp/config.yml,models.yml,mcp.json, as they are in the working tree when you deploy: see What gets deployed is the working tree, not a commit) is copied into~/.omp/agent/as writable files. So is mise's global config (~/.config/mise/config.toml).home/linux/writable-copy.shdoes the copying. - The repo copy replaces the file only when the repo copy is new since the last install (a hash under
~/.local/state/dotfiles/writable-copy/). An edit made on the VM is then kept as<name>.dotfiles-backup(one previous version). Otherwise an edit stays across deploys and reboots (Home Manager activates at every boot). - Nix pushes no secret. Put
~/.omp/.envin place by hand: it is deliberately not synced (the command is under The omp .env file). The one secret that reaches the VM is the Hindsight key thatjust vm-syncwrites (see Hindsight). - The
ghlogin is yours as well:gh auth loginon the VM. - The omp config in the repo was written for the Mac, and these parts cannot work on the VM: the omniroute, anthropic-refresher and xai-refresher providers (homelab addresses, unreachable from the VM), the
unitllmprovider, and the MCP serverszennotes,open-designandunsplash(Mac paths).codegraphis not installed either. - The hindsight memory backend works through the public URL and key that
vm-syncsets as environment variables (see Hindsight). - Models and roles that name a provider without a credential on the VM fail until you change them.
- The global tools are node, python 3, uv, go, rust, bun and
npm:pnpm, alllatest(3for python). They are installed on first use (not_found_auto_install) or bymise install, into~/.local/share/mise(outside Nix). - The agent role uses nixpkgs-unstable's mise. nixos-25.11's (2025.11.7) takes the free-threaded CPython build for python 3.13 and later and fails with "Python installation is missing a
libdirectory"; 2026.8.6 installs python 3.14. node.compileis off because mise compiled node from source by default on this VM and failed on a missing python. The prebuilt node runs through nix-ld (measured:mise use -g node@lts, thennode --version).mise use -gworks because the global config is a writable file.- mise's tools float (
latest, installed on first use), unlike the omp seed, which is pinned by hash (the omp you run is the copy thatomp updatekeeps current: see omp).mise use -g <tool>@<version>pins one.
tern remote setup <user>@<ipv4>, run on the Mac after the role is deployed, downloads Tern (the VM does it itself) into~/.local/share/tern, links~/.local/bin/tern, writes the user service~/.config/systemd/user/tern-remote.serviceand starts it.tern remote doctor <user>@<ipv4>checks it, and the Mac's host list (~/Library/Application Support/Tern/hosts) gains<user>@<ipv4>.- Tern's binary, its state in
~/.config/ternand that unit are Tern's, not managed byvm-deploy. See Update Tern on the VMs. - The service serves QUIC on UDP 8376 (measured with
ss; the Tern service on the Mac listens on 8377 because it is told to). The firewall opens exactly that, only withdotfiles.agent.tern.enable.
- A drop-in that the module installs (
tern-remote.service.d/10-direct-lan.conf) starts the service with--relay none. It never contacts Stencil's relay (my.omp.shsince 0.9.9, iroh.stencil.so before) or any other, and only a Mac with a UDP path to the VM reaches it (measured: the service opens no other UDP port). - Deploy before
tern remote setup. A service that started without the drop-in connected to the relay and published an endpoint id, and its first setup added the host to the Mac's list by endpoint id (<user>@<endpoint id>). After the drop-in and a restart,tern remote setupagain adds<user>@<ipv4>; the endpoint-id line is then stale and can go from the hosts file. - Without a UDP path from the Mac to the VM (another network, no VPN) the Mac cannot reach it. Before the drop-in, setup fell back to the relay; with it, nothing does. Turning the relay back on is a deliberate change that this module does not make.
From the Mac, every host in its Tern list at once:
tern remote hosts | while read -r h _; do tern remote update "$h" </dev/null; donetern remote update <user>@<ipv4>does one host, as does Update in Tern's Settings → Hosts. The VM downloads the build with the Mac's Stencil account. The service starts again as the new build: its windows reconnect and the sessions carry on (measured 0.7.1 → 0.8.3 on a VM with five omp running: the session daemon and every omp kept their pids).- It needs the drop-in's
PATH: a NixOS user unit gets only systemd's ownbin, and the updater shells out to unpack the build. Without it every update failed withCouldn't unpack the update: No such file or directory(the VM'sjournalctl --user -u tern-remote), andtern remote updateon the Mac said onlyThe host stopped answering: connection lost. tern remote updaterun on the VM itself (no host) asks for a Stencil sign-in by device code instead; the link from the Mac does not.
- The drop-in repeats Tern 0.6.0's own
ExecStart(~/.local/share/tern/build/tern remote serve --user --state-dir ~/.config/tern) with--relay noneadded; 0.9.9 still writes the same command. If atern remote updatechanges that command, change the drop-in too. - Up to 0.8.x the drop-in also passed
--pkarr none --no-iroh. Tern 0.9.9 dropped both flags (--relay noneturns off both). An update re-runs the service with the arguments it was started with, so the 0.9.9 update stopped it withunknown argument --pkarr(status 2, the VM'sjournalctl --user -u tern-remote), and systemd does not restart on status 2: the Mac then saysThe host did not answer … over UDP to <ip>:8376while ssh still works. When a release drops a flag the drop-in passes: change the drop-in,just vm-deploy <name>, thensystemctl --user restart tern-remote.serviceon the VM. - A running service takes a changed drop-in only after
systemctl --user restart tern-remote.serviceor a reboot. Check withps -u <user> -o args=that its line ends in--relay none.
This is an opt-in, in ~/.zshenv.
- Tern hands a program a pasted image, or the bytes of a copied file, only if the program turns on paste events first (it writes
ESC [ ? 5522 h). - omp 18.8.7, 18.8.8 and 18.8.9 never write it (measured with a pty logger under Tern: no 5522 byte in any of the three, each started in a Tern pane).
- So ⌘V in an omp pane on the VM types the Mac path of a copied file (omp answers
Image not found at <that path>) or pastes nothing for an image-only clipboard (Clipboard is empty). - In v18.8.9 omp registers the opt-in as a start listener (
input-controller.ts:894-895). Reading the source, it is probably added after the UI started, so it never runs (not tested). No setting or environment variable of omp turns it on.
The fix:
home/linux/omp-image-paste.zshis anompfunction that goes into~/.zshenvwith the Tern piece (dotfiles.agent.tern.enable).- It writes the sequence before omp and resets it after, however omp ends (exit, error exit, Ctrl-C), only when stdin and stdout are terminals and
TERM_PROGRAMistern. - Arguments and exit status pass through, so
omp update,omp --versionandomp -p ... | lessare unchanged. - It needs Tern 0.7.x on the VM (a 0.6.0 service lists only
text/plain). - A pane that was running before the deploy needs a new shell (
exec zsh) and then omp started again: an omp that already runs never gets it.
Where it runs:
- Tern runs a pane's program through the login shell (Tern's own docs for
agent_command). Measured on the VM and on the Mac, the pane's process iszsh -l(an interactive login shell, no-c) with omp as its child, so a typedompcalls the function. - It is in
~/.zshenvrather than~/.zshrcso that azsh -c ompgets it too (the test runs both forms). - The process line of an agent block (Tern's chat surface for
omp) was not observed. The function is for the terminal pane, where ⌘V goes through the terminal.
Measured on a throwaway Tern 0.7.1 daemon on the VM, in an isolated Tern window, never the real session:
- A PNG-only clipboard gives an image chip.
- A clipboard with a file URL next to the PNG is listed as
text/plain,image/pngandtext/uri-list, and omp takes the PNG and shows a chip. The layout is the one that Vorssaint's copied screenshots should have, taken from its code; the clipboard was not made by Vorssaint itself. - Without the opt-in the same clipboard gives
Image not found at <that path>. - A text paste is unchanged.
Tests: home/linux/omp-image-paste_test.sh (in just test-infra) tests the function in a real pty. infra/roles-check.sh checks that it is in ~/.zshenv byte for byte with the Tern piece and gone without it.
virtualisation.podman is rootless: the user has subuid and subgid ranges, and the newuidmap wrappers come with NixOS. podman run --rm docker.io/library/hello-world works as the user. zramSwap is on.
Option dotfiles.agent.docker.enable, on when the agent is.
- It sets
virtualisation.docker.rootless(withoutsetSocketVariable, see below) and the packagedocker_29(29.6.0). - nixos-25.11's default
pkgs.docker(28.5.2) is marked insecure, unmaintained since November 2025, and refuses to evaluate.docker_29is the same nixpkgs, so no unstable. docker compose(2.40.3) anddocker buildx(0.29.1) come with that package (measured:docker compose version).
The rootful daemon (virtualisation.docker.enable) listens on /var/run/docker.sock for the docker group. That group is root on the machine (docker run -v /:/host), which the user (no sudo, not in wheel) must not be.
So there is no rootful daemon, no docker group, nobody in it and no /var/run/docker.sock. just test-roles fails if one appears, and also if podman's dockerCompat or dockerSocket is turned on (that would make the docker command podman).
- The daemon is the NixOS user unit
docker.service(dockerd-rootless, refused for root) of the user: socket/run/user/<uid>/docker.sock, data in~/.local/share/docker. It starts at boot through linger. - A NixOS switch only loads a user unit that it adds and never starts it (measured on the first deploy: the unit was there and inactive), and Home Manager starts only its own units. So a Home Manager activation step (
home/linux/start-user-unit.sh, afterreloadSystemd) startsdocker.service. At boot Home Manager runs before the user manager exists, the step does nothing, and the manager starts the unit itself. - Rootless podman stays beside it and keeps working (
podman run --rm docker.io/library/hello-world, measured with Docker running). Their storage is separate (~/.local/share/containersagainst~/.local/share/docker). Both map the user's one subuid and subgid range (lex:100000:65536, one line in/etc/subuidand/etc/subgid) into a user namespace of their own, so nothing is shared.
They use a Docker context, not DOCKER_HOST.
- Home Manager makes the context
rootless(unix:///run/user/<uid>/docker.sock) and makes it current, once, when it creates it (home/linux/docker-contexts.sh, a step afterwriteBoundary). A context that you switched to later stays current, and a context that exists with another host is updated. DOCKER_HOSTis not exported on purpose. Measured, while it is set:docker context useonly warns that the variable overrides the active context,DOCKER_CONTEXTis ignored, and so is lazydocker's context lookup (docker --contextalone still wins). SosetSocketVariable(which exports it to every shell) would make thejumphostcontext unusable.- The current context is read from
~/.docker, sodocker,docker composeand lazydocker find the rootless daemon in an ssh login shell, inzsh -c, inzsh -icwith and without a terminal, and in a shell started by a user service (Tern's way).docker psworks in each. - lazydocker has no non-interactive mode. Run in a real terminal with a container up, it lists the container, and with
DOCKER_HOSTpointing nowhere it says it cannot connect. DOCKER_HOST=…orDOCKER_CONTEXT=jumphostsets another daemon for one command.
- rootlesskit binds
-p 18080:8080on all interfaces of the VM, and the firewall is unchanged (TCP 22 and UDP 8376 only). So only the VM itself (127.0.0.1) gets through. Measured from the Mac: the port is closed, port 22 open. - Reach one with
ssh -L. - Opening a port to the LAN is a change of
networking.firewallin the module on purpose, never a side effect ofdocker run. - Rootless Docker cannot bind ports below 1024 either (the sysctl is not changed).
vm-deploystopsdocker.servicebefore the switch (the same place where the plugin and Mason installs are stopped), so no daemon and no container runs on as the removed user. Measured: the stop takes about 11 s, leaves no process of the user, and removes the socket.- It then asks systemd whether the unit is still up and refuses the flip (exit 1, before the role changes) if it is.
- This is the same step as the removal of synced files, so it needs the VM's host key to be pinned on this Mac. When it is not,
vm-deploysays that the removal is skipped, and the daemon and its containers keep running as the removed user until the next boot. - If the switch itself fails after the stop, the role is still
agentbut Docker stays down untilsystemctl --user start dockeror the next deploy. - Images, containers and volumes stay in
~/.local/share/dockerwith the rest of the home, like podman's.
dotfiles.agent.docker.enable = false removes the daemon unit, the docker CLI, the start step and the context step (the contexts already made stay in ~/.docker).
- The jumphost piece needs Docker, so turn that off too (an assertion says so otherwise).
- Measured: the switch does not stop a daemon that is running (its unit file is gone, and the daemon and its containers keep running). So stop it first (
systemctl --user stop docker), or after the switch by the same name.~/.local/share/dockerstays. - The tools and podman stay.
A deploy never restarts a daemon that is running (start on an active unit does nothing, and NixOS does not restart user units). After a change of the Docker or rootlesskit package the old daemon keeps running until systemctl --user restart docker (which stops the containers) or the next boot, while the docker CLI is already the new one.
Option dotfiles.agent.jumphost.enable, on when the agent is. It needs docker.enable (an assertion says so).
It gives the user two things on the jumphost, each through its own key:
- a login shell:
ssh jumphost_server, the same name as on the Mac; - a second Docker context,
jumphost=ssh://jumphost_docker. Sodocker --context jumphost ps,docker context use jumphostand lazydocker reach the Docker daemon of the jumphost. The local rootless daemon stays the default.
- The host values (its name, address, user and ed25519 host key) are in
home/ssh/jumphost.nix. It is one file that the Mac's ssh config (home/default.nix) and the VM's both read, so they cannot drift (the Mac's darwin derivation is unchanged by that refactor). - On the VM there are two ssh entries for that one host, and no other entry:
jumphost_server(the Mac's name for it) with the shell key~/.ssh/id_ed25519_jumphost_shell;jumphost_dockerwith the Docker key~/.ssh/id_ed25519_jumphost, used by the context.
- Each entry has only its own key (
IdentitiesOnly),StrictHostKeyChecking yesagainst one pinned file (~/.ssh/known_hosts.d/jumphost_server, the jumphost's public host key) and no global known_hosts. - Two keys, not one: sshd picks the
authorized_keysline by the key, so one key cannot be both the restricted Docker line and a login. - None of the Mac's
Host *defaults (User root,StrictHostKeyChecking no,UseKeychain) and none of the Mac's other keys or hosts are there.
- Both keys are made on the VM, once, by a Home Manager step before the links (
home/linux/ssh-key.sh): ed25519, no passphrase, mode 600, with the commentsuser@host docker-jumphostanduser@host shell-jumphostbuilt at run time. - Their private halves never leave the VM and are never printed, copied, or stored in the vault or the repo. An existing key is never replaced.
One step on the Mac per key: just vm-jumphost-authorize <vm> for the Docker key, just vm-jumphost-authorize <vm> shell for the shell key (infra/vm-jumphost-authorize.sh). A VM gets a shell only when you run the second.
- It reads only the public half over ssh (a regular file, at most 2 KiB; the VM's host key must be pinned, like
vm-sync). - It appends it to the jumphost's
~/.ssh/authorized_keys:- the Docker key as
restrict,command="docker system dial-stdio" ssh-ed25519 <key> <vm> docker-jumphost; - the shell key as
ssh-ed25519 <key> <vm> shell-jumphost, with no options, like the Mac's own key.
- the Docker key as
- The script on the jumphost writes those two forms and nothing else: any other line, a line with a line break, or a comment that does not end in the right purpose is refused.
- It makes a backup first (
authorized_keys.bak-<timestamp>), writes atomically, and works once: a second run changes nothing and makes no second backup. It touches no other line. - It refuses a VM name with odd characters, a kind other than
dockerorshell, a key that is not ed25519, a link in place ofauthorized_keys, and a key that is already there with other options (so a shell key that is already a restricted line stays restricted). A different comment does not count: such a line is already authorized and is left as it is.
The Docker key can only run the Docker API stream: no shell, no pty, no port forwarding, no sudo (restrict). The shell key has all of that, as the jumphost's account. The jumphost's docker group is root-equivalent there, so either key gives the user that much power on the jumphost; the shell key also gives forwarding through it.
- The shell: delete every line of the jumphost's
authorized_keysthat carries the comment<vm> shell-jumphost. The context keeps working. - Docker: delete every line that carries
<vm> docker-jumphost. - The Mac builds those comments from the VM's name and never takes the comment that the VM wrote, so a VM cannot choose the text that names its line.
- There can be more than one line per comment. A reinstalled VM makes new keys, and the script appends them next to the old ones and never removes a line, so every old key stays valid until its line is gone. Tell them apart by fingerprint, with the steps under Reinstall.
- The key files on the VM can go too.
lazydocker 0.24 reaches an ssh:// context with ssh -L socket forwarding, which restrict forbids. So in the agent role lazydocker is a small wrapper (home/linux/lazydocker-ssh.sh):
- for an
ssh://context it starts a local bridge (socatlistening on a mode-600 socket in$XDG_RUNTIME_DIR, each connection runningssh jumphost_docker docker system dial-stdio), points lazydocker at it withDOCKER_HOST, and removes the bridge when lazydocker exits; - for any other context, or when
DOCKER_HOSTis already set, it runs lazydocker unchanged.
dotfiles.agent.jumphost.enable = falseremoves both ssh entries, the pinned file, the key step, the context step and the wrapper.- The key files and the contexts already made stay in the home (like the rest of
/home/lex), and the authorized lines stay on the jumphost until you remove them. - The agent-to-clean flip leaves the keys and the contexts in the home and never touches the jumphost.
Option dotfiles.agent.tools.enable, on when the agent is.
- They are packages of the user (
/etc/profiles/per-user/lex/bin, so on thePATHof every login, Tern andzsh -cshell), from nixos-25.11:just1.43.1,lazygit0.56.0,lazydocker0.24.2,tokei13.0.0,btop1.4.5,kubectl1.34.3,k9s0.50.16,superfile1.3.3,zoxide0.9.9. Unstable has 1.58.0, 0.65.1 and 0.25.2 for the first three and 1.6.0 for superfile; nothing in 25.11 is broken, so it is not used. - nixpkgs installs superfile's program as
superfileonly; upstream'sspfis not there.sfis the alias for it. kubectl1.34.3 is within one minor version of the clusters it talks to (1.35.0, measured), the skew that Kubernetes supports. Unstable's 1.37.1 is the Mac's; switch the tools piece to it (nixpkgs-unstable, asmodules/nixos/agent-dev.nixdoes for secretspec) when a cluster moves to 1.36.- Their config (
~/.config/lazygit,~/.config/lazydocker,~/.config/btop,~/.config/k9s,~/.config/superfile) is theirs: nothing manages it, and the first run of lazydocker, btop, k9s and superfile writes its own. The Mac'shome/btop/btop.confand its k9s settings and transparent skin (programs.k9sinhome/default.nix) are not put on the VM. - No kubeconfig comes with it:
kubectlandk9sread the~/.kube/config(orKUBECONFIG) that you put on the VM. - zoxide's hook (
z,zi, its own directory database under~/.local/share/zoxide) is in~/.zshrc, after the onecompinitof the interactive zsh. Home Manager'sprograms.zoxideis not used: it puts the hook before thatcompinit, and zoxide then registers no completion forz(measured). A shell without a terminal (omp's) leaves before it, as on the Mac. - The Mac's aliases
ld(lazydocker),top(btop),k,kxandkns(kubectl) and functionlg(lazygit that follows the directory change on exit) find their tools on the VM. sf(superfile) is the VM's own alias, next to zoxide's hook in~/.zshrc: it is not in the Mac'saliases.zsh, because the Mac has no superfile.- Off: the packages, the hook and
sfgo, nothing else.
Option dotfiles.agent.vault.enable, on when the agent is. It installs packages of the user for the UnitLLM repo on the VM (its just vault-login, just vault-status and secretspec runs):
bao:openbao2.5.5 of nixos-25.11; itsbinholdsbaoand novaultalias.secretspec: 0.21.1 of nixpkgs-unstable, because nixos-25.11's 0.3.3 is too old. Measured on the VM with no token,secretspec check -n -p unitllmand-p unitllm-agentstop with "No Vault token found" and "No JWT available", not with a parse error.
Nothing else comes with it: no token, no config, no login, and no OpenTofu, terragrunt, talosctl or helm (Terraform stays on the Mac). kubectl and k9s come with the tools piece.
The vault's OIDC role allows one redirect, http://localhost:8250/oidc/callback, and bao login listens on the machine it runs on. So on this headless VM the sign-in finishes in the Mac's browser through a tunnel.
infra/vm-vault-tunnel.sh runs ssh -N -L 8250:localhost:8250 <user>@<ipv4> in the foreground, with the host key pinned and on loopback only. It refuses when TCP 8250 is in use on the Mac or the VM has the clean role.
just vm-vault-tunnel <name> # on the Mac, kept open; Ctrl-C ends it
just vault-login # on the VM, in the UnitLLM repo; open the URL it prints in the Mac's browserMeasured without signing in:
bao login -method=oidcon the VM prints the sign-in URL on stderr, with that callback as itsredirect_uri, says that it cannot open a browser (noxdg-open) and keeps waiting.- Through the tunnel the Mac reaches its listener:
GET /is a 404, andGET /oidc/callbackwith no parameters gets bao's page, after which bao exits with "Expired or missing OAuth state".
The token that the UnitLLM recipe saves (~/.config/openbao/unitllm-gateway.token) has that vault's admin policy for 24 h, and anything running as lex on the VM can read it.
Revoke it with bao token revoke -self (the address and the token as the UnitLLM justfile exports them) and delete that file when you are done.
Option dotfiles.agent.caBundle.enable, on when the agent is. It sets SSL_CERT_FILE for the user.
- mise's prebuilt Python finds no CA bundle on NixOS (
/etc/ssl/certsholds only the bundle links) and failed every HTTPS request withCERTIFICATE_VERIFY_FAILED. - So
SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crtis exported by~/.zshenv(every zsh: an ssh login,zsh -c,zsh -lc, the shell of a Tern session, omp's shell; a value that is already set is kept) and set in the user manager's environment (user services). - That turned a Python HTTPS GET from failing in 7 of 7 kinds of shell and service into HTTP 200 in all 7 (measured), an omp that started before the deploy included.
Option dotfiles.agent.zsh.enable, on when the agent is (home/linux/zsh.nix). It gives the VM the Mac's aliases, options, keybindings and plugins.
home/zsh/config/aliases.zsh,options.zshandkeybindings.zshare sourced from the store copy that the flake names, byte for byte (just test-rolescompares each with the repo file, and the Mac's derivation does not change). So editing one changes both machines.- The plugins come from nixpkgs (nothing is fetched at shell start):
zsh-syntax-highlighting0.8.0,zsh-autosuggestions0.7.1,zsh-completions0.35.0,zsh-history-substring-search1.1.0,fzf-tab1.2.0, andfzf0.67.0 throughprograms.fzf, which fzf-tab calls too. - fzf's own key bindings: Ctrl-T (files), Ctrl-R (the zsh history,
~/.zhistory; fzf's widget, not the Mac's Atuin picker) and Alt-C (directories). Home Manager loads them at order 910, before the plugins, so fzf-tab still owns Tab. fzf-tab-source(Freed-Wu) is in no nixpkgs (25.11 and unstable: measured), so it is pinned inhome/linux/zsh.nixby commit (3253ab5, 2026-07-21) and hash. Bump it withnix flake prefetch github:Freed-Wu/fzf-tab-source.- The load order is the Mac's
home/zsh/zshrc: the three files, then the plugins, thencompinit.
- A shell without a terminal (omp's shell, a scripted
zsh -i) leaves~/.zshrcat once, as the Mac's early exit does (order 500), keeping onlymise activate. zsh -candzsh -lcnever read~/.zshrc.- So they load no plugin and print nothing.
HINDSIGHT_API_URL,HINDSIGHT_API_TOKENand the mise and TernPATH(all from~/.zshenvand the profile) stay set (measured). Also measured: omp's shell tool ran commands through its shell without an error.
- The Mac's
options.zshalso installs achpwdhook that sources a.envfile of the directory youcdinto (interactive terminal only). It is loaded here too, so a Docker Compose.envthat is not shell syntax (spaces,$) is sourced as shell code atcd. EDITORandVISUALarevimwhen there is nonvim(options.zshsets them to the output ofwhich nvim, which is the textnvim not foundhere).options.zsh'sHISTFILE=~/.zhistoryreplaces Home Manager's~/.zsh_historyas on the Mac, and the old file is not read any more.- The aliases of tools the VM does not have (
brew,zap,open,gdu-go,sdl-freerdp, ...) stay defined. Loading the files runs none of them (lg,dkandpkguponly define functions; the test shims every command that an alias names and asserts that none was called), and calling one sayscommand not found.
Measured.
- NixOS's
/etc/zshrcrancompinitbefore~/.zshrc, so a completer that~/.zshrcadds to thefpathafterwards (zsh-completions) was never registered in$_comps. Replayed on the VM,_afewisnonein that order and_afewin the role's. - So with this option
programs.zsh.enableGlobalCompInitis off (enableCompletionstays on: it links the system profile's completers) and~/.zshrcmakes the onecompinitcall, after the plugins. - It is cached like the Mac's:
-C(no security audit) while the dump is under a day old, a full run once a day, and a full run for every new system generation too. A deploy changes the packages that carry completers, and a dump from before would hide them; a young dump of the older/etc/zshrccall did exactly that. - The dump is
~/.cache/zsh/zcompdumpwithzcompdump.key. - Measured on the VM: 87 ms for
zsh -i -c exitin a terminal with a warm dump (22 ms with no rc file at all, 477 ms with a cold dump), onecompinitcall per start, 1945 completers registered,dockerandjustamong them.
home/zsh/zshrcitself: it is the Mac's (zap installed withcurlat shell start,getconf DARWIN_USER_TEMP_DIR,~/Library/pnpm, kubectl, treehouse and aws completions, the todo files).- Atuin (a history sync server and a login; Ctrl-R is fzf's history widget instead), eza (the Mac's
lsintegration), bat and tmux (the Mac'sprograms.*inhome/default.nix, not in the shared files). None is installed on the VM; their aliases (t,ta,vfor nvim) stay defined and saycommand not found.topruns btop andkruns kubectl, and zoxide'szandsf(superfile) are there: the tools piece installs them. - The Mac's
tmp.zshhook is a local file that is not in the repo.
dotfiles.agent.zsh.enable = false: ~/.zshrc loses all of this, fzf goes, and /etc/zshrc runs compinit again, as before. The completion dump and ~/.zhistory stay.
Option dotfiles.agent.browser.enable, on when the agent is.
- The
chrome-devtools-axiskill (npx -y chrome-devtools-axi open <url>,snapshot,console,screenshot <path>,stop) and omp'schrome-devtoolsMCP server (home/omp/mcp.json:npx -y chrome-devtools-mcp@latest) both run chrome-devtools-mcp. - chrome-devtools-mcp starts Chrome itself, when a command needs it, over a pipe (no debug port). On Linux it looks for the stable channel at
/opt/google/chrome/chrome. - That path is a link, made by systemd-tmpfiles at boot and at every switch, to the main program (
bin/chromium) ofpkgs.chromiumof nixos-25.11 (149.0.7827.200; closure 1.69 GiB in 355 store paths, 511 MB to download). It is no system package and on nobody'sPATH. /opt,/opt/googleand/opt/google/chromeare root's, 0755 (measured: the user can neither remove nor replace the link, nor add a file beside it).- Nothing runs while no tool uses it: no service, no socket, no timer, no firewall port.
Measured.
- chrome-devtools-mcp 1.10.1 has
--executablePath, but chrome-devtools-axi 0.1.39 cannot pass it: itsCHROME_DEVTOOLS_AXI_CHROME_ARGSbecome--chrome-arg=..., which go to Chrome, not to the MCP server. CHROME_DEVTOOLS_AXI_MCP_PATH(a node script that the CLI runs instead ofnpx) does work with a wrapper that adds the flag (measured: firstopen15 s,stopclean). But it needs a variable in every shell and a wrapper file, and it does not reach omp's MCP entry, which is the Mac's file and names no executable.- The link needs no variable and serves both.
The package is pkgs.chromium.override { commandLineArgs = "--headless=new --disable-gpu"; }. Only nixpkgs' small wrapper script changes, the browser itself is the stock one, and just test-roles accepts exactly these two flags there and no other.
--headless=new, because the VM has no display and omp's MCP entry (the Mac's, with no--headless) would otherwise stop at "Missing X server" (measured).--disable-gpu, because the VM has no GPU. With the software GL fallback that Chromium then takes, its GPU process runs with no seccomp filter (measured: seccomp 0 in every launch, 2 with the flag). Chromium's own message for that fallback is "Please use the --enable-unsafe-swiftshader (about:flags#enable-unsafe-swiftshader) flag to opt in to lower security guarantees for trusted content" (measured).- The cost is WebGL:
getContext("webgl")works without the flag and fails with it (measured directly and through the CLI, three runs each). The sha256 of a screenshot of a plain page is the same with and without the flag (measured). - To get WebGL back, add
--enable-unsafe-swiftshadertocommandLineArgs(and to the exact list thatjust test-rolesexpects). WebGL works then, and the GPU process is back to seccomp 0 (both measured).
Measured on the VM.
- Chromium's user-namespace sandbox works for the user with no setuid helper, no change to a kernel setting and no
--no-sandbox(the same user namespaces that rootless Docker and podman use). - In a run: the renderers (4) and the network service run in their own user and pid namespaces with a seccomp filter (
Seccomp: 2,NoNewPrivs: 1), and the GPU process and its broker have the filter. - None of the 13 browser processes of that run has
--no-sandbox,--disable-setuid-sandbox,--disable-namespace-sandbox,--disable-seccomp-filter-sandboxor--disable-gpu-sandboxon its command line (a scan of/proc/<pid>/cmdlinewith a planted-flag positive control). The browser carries--remote-debugging-pipeand no--remote-debugging-port. - Three processes are unsandboxed by Chromium's own design: the browser process, the main zygote (its own flag
--no-zygote-sandbox: it is the parent that forks the sandboxed ones) and one utility process (--service-sandbox-type=none).
just test-roles keeps it so:
- It compares every setuid or capability wrapper, kernel setting, tmpfiles rule, unit, socket, timer, package, environment variable, group of the user and sudo entry with the agent with the option off. It accepts exactly three tmpfiles rules and one line of
~/.zshenvas the difference, whatever the names. - It finds no flag that turns a sandbox off, no
PUPPETEER_DANGEROUS_NO_SANDBOXand noremote-debuggingin the rules, the wrapper,~/.zshenvor the environment of the system, the session and Home Manager. - A scan of
modules/andhome/(with a positive control that it reads the two files of the piece) finds no such flag in any source.
After a nixpkgs bump, re-check the GPU process while a browser runs: for p in $(pgrep -f -- --type=gpu-process); do awk '/^Seccomp:/{print $2}' /proc/$p/status; done must print 2.
- chrome-devtools-axi starts a small bridge (a listener on
127.0.0.1:9224) and, through chrome-devtools-mcp, the browser at the first command, and keeps both untilstop. - The bridge refuses a rebound request (measured: 403 for a Host that is not loopback and for a non-loopback Origin; 200 for a loopback Host with no Origin and for a loopback Origin; 400 with no Host header).
~/.zshenv(read by every zsh: an ssh login,zsh -c, the shell of a Tern session, omp's shell) exportsCHROME_DEVTOOLS_AXI_IDLE_TIMEOUT_MS=900000, next to the Hindsight snippet. So a browser that nobody stopped is stopped by its CLI after 15 minutes without a command (measured with a 6 s timeout: browser, bridge and listener gone 6 s after the last command). It is the only variable of the CLI that is set.- After
stop: no chromium or crashpad process, no bridge, no listener on 9224 or 9222. - omp's MCP server starts the browser at its first tool call and leaves with omp. Unlike the CLI it uses a persistent profile (
~/.cache/chrome-devtools-mcp/chrome-profile: cookies and logins stay between sessions). - The MCP entry was driven over stdio with the exact entry of
~/.omp/agent/mcp.jsonby a small JSON-RPC client (initialize, tools/list, navigate, snapshot, console, screenshot). omp itself was not run.
Measured.
- A page load of the local test page plus
https://example.compeaks at 1.4 to 1.6 GiB of resident memory summed over 18 to 20 processes (five runs), 0.7 GiB with shared pages counted once, and the system's available memory dropped by 0.5 GiB (one run each; the VM has 7944 MiB and zram). - The first
openwith an empty npm cache takes 13 s (one run; the CLI waits 30 s for its bridge by default,CHROME_DEVTOOLS_AXI_BRIDGE_TIMEOUT_MS). - Fonts: DejaVu Sans is the only font on the VM (
fc-listlists it alone, andfc-matchgives it for sans-serif, serif, monospace and emoji), so serif and monospace text draws in the sans face. Text in other scripts and emoji will likely draw as boxes (not measured).
The agent can browse any site that the VM can reach, with the VM's network: the LAN and loopback included. That is what a browser tool is. Do not log in to anything in its profile that you do not want it to use.
dotfiles.agent.browser.enable = falseremoves the rules and the variable at the next deploy.- systemd-tmpfiles makes a link but does not remove what a rule that is gone once made (measured on a flip to clean for
/lib64/ld-linux-x86-64.so.2, see Agent to clean; not measured for this link, no flip was run). So/opt/google/chrome/chromeis expected to stay: root's link to a store path that stays until the generations that name it are deleted and garbage collected. vm-deploydoes not remove it: its removal step runs as the agent user only, never as root.rm -r /opt/googleas root removes the link.- A running browser is not stopped by
vm-deploy, andvm_unsyncstops only the install units and the Docker service. The CLI's idle timeout ends a browser of the CLI, and omp's end ends one of its MCP server.
Option dotfiles.agent.blender.enable, on when the agent is. It is not on the Mac: home/omp/mcp.json is unchanged. The VM's copy of that file gains a blender entry at every activation, after the writable copy, so a newer repo file does not drop it.
- MCP for Blender is two processes. omp starts the MCP server (
uvx mcp-for-blender, pinned2.1.9inhome/linux/agent.nix). That server talks to an addon inside a running Blender, on127.0.0.1:9876. - The addon refuses
blender -b: its command timer never runs in background mode, so a command would be accepted and never executed. The user serviceblender-mcpruns Blender under cage's headless Wayland backend with Mesa llvmpipe (the NixOS Xvfb build has no GLX module, so Blender cannot open a window there) and enables the addon fromblender-mcp-enable.py. The socket stays on localhost. The firewall is unchanged. - The addon is installed into
~/.config/blender/<major>.<minor>/scripts/addonsby the same pin, before Blender starts. The first start downloads the package and a uv-managed CPython 3.11, so it needs the network. Later starts use the cache. BLENDER_MCP_SAFE_MODE=1: modelling, materials, rendering, saving and import/export work; a script that reads or writes a file directly, runs a program, or opens the network is sent back to the model.DISABLE_TELEMETRY=true.- One Blender, one MCP client. A second omp session on the same VM that also calls the blender tools will contend for the socket. Exports land in
~/blender. - A new omp session on the VM picks up the entry. An already-running omp does not.
dotfiles.agent.blender.enable = falseremoves the unit at the next deploy. Theblenderentry already written into~/.omp/agent/mcp.jsonstays until you delete it (the writable copy keeps a VM edit). A Blender that is already running is not stopped by that deploy:systemctl --user stop blender-mcp.service.
Set role to agent, then just vm-deploy <name>. Then run tern remote setup if you want Tern.
The first deploy builds the module on the VM and fetches omp (about 270 MB), and for the Mason piece neovim, go and the Rust toolchain (1.6 GiB of it): see Mason language servers for omp.
Set role to clean, then just vm-deploy <name>.
NixOS removes what the module declares: the services, the packages, the firewall port, zram, the user's entry in the account database and its subuid range.
Measured leftovers:
- The home directory stays, with everything in it:
~/.ssh/authorized_keysand any key you added there;- Tern's binary and state;
- omp's config;
- mise's installed tools;
- the Mason language servers in
~/.local/share/nvim/mason(see Mason language servers for omp); - podman's images;
- Docker's images, containers and volumes in
~/.local/share/docker; - the Docker contexts in
~/.docker; - the key that the VM made for the jumphost (
~/.ssh/id_ed25519_jumphost; its authorized line on the jumphost stays too until you remove it); - Home Manager's links, which dangle after a garbage collection.
- The user's uid stays reserved, so the user comes back with the same uid and finds its home.
/lib64/ld-linux-x86-64.so.2stays as a link into the store (it is a tmpfiles link, harmless).- The rootless Docker service is stopped by
vm-deploybefore the switch (see Docker), so no daemon or container runs on. - Tern's service and the user's manager keep running as the removed user until
systemctl stop user@<uid>.serviceor the next boot. The firewall has closed the port at once, and nothing restarts them after a reboot.
Expected, not measured (no flip was run):
- The browser link
/opt/google/chrome/chromestays the same way (root's, a link into a 1.69 GiB closure; see A headless browser for the browser tools). - A browser that is running at the flip keeps running as the removed user like Tern's service, until the CLI's idle timeout or omp's end stops it.
Flipping back to agent works: the user, linger, the services and Tern's service return, and the Mac's host entry works again without a new setup. A truly clean VM needs a reinstall with role clean.
- Options
dotfiles.agent.sync.hindsight,.pluginsand.skills, each on when the agent is. The VM lists them in/etc/dotfiles-agent-sync.json, whichjust vm-sync <name>reads. just vm-deploy <name>runsvm-syncafter an agent deploy. When that sync fails or is refused, the deploy has still happened and exits 1: fix the cause, thenjust vm-sync <name>.~/.omp/.envis not synced, in any form: it holds the API keys, so put it in place by hand.just vm-syncitself runs on the Mac and is for the agent role only. Everything it runs on the VM is the agent user's (infra/vm-sync-remote.sh, sent over ssh), never root's.
- Every connection of
vm-sync(ssh and rsync) usesStrictHostKeyChecking=yesandUpdateHostKeys=no. - The VM's key must already be pinned in
~/.ssh/known_hosts. Otherwisevm-syncrefuses before it sends anything and says so, naming the re-key step of Reinstall:ssh-keygen -R <ipv4>, then connect once, orjust vm-deploy <name>, which trusts a key on first use as it always did. - The VM's console has no login, so there is no second channel to compare a fingerprint with: what you check is that the address belongs to the VM.
vm-installis unchanged.vm-deploytakes the answer before its switch (the switch itself may pin a new key):- an agent deploy over a key that was not pinned before it (or that could not be probed) still deploys, does not sync, and exits 1 with that message;
- a clean deploy over an unpinned key skips the removal described under Flip to clean: removing what the sync placed, because nothing can be verified over such a key (files that a sync from another Mac, or from before the key was cleared, put into
/home/lexstay there: pin the key and flip toagentand back to remove them); - a key that does not match stops it before anything is changed.
- Log in on the VM with
gh auth login. The CLI and git's credential helper forgithub.1485827954.workers.devandgist.github.com(Home Manager) are installed, and nothing in this repo or in the vault holds a GitHub token. - gh keeps its login and config in
~/.config/gh, which nothing here manages (a plain directory that gh writes itself). So no deploy, sync, reboot or role flip overwrites or deletes it. Switching to clean leaves it in/home/lex.
~/.omp/.env is manual too. It holds the model API keys and nothing here copies it.
- On the Mac it is written from the vault blob
OMP_ENV(just homepulls it;just secretspec-syncpushes an edit). - The VM needs only the providers it can reach (see omp). Make a private file with just those lines, outside the repo, then put it in place over ssh. That keeps it off the terminal and out of argv, and
umask 077makes it mode 600:
ssh <user>@<ipv4> 'umask 077 && mkdir -p ~/.omp && cat > ~/.omp/.env' < <your prepared file>omp reads it at its next start. A reinstall deletes it.
just omp-plugins-capture(on the Mac) copiespackage.json,bun.lockandomp-plugins.lock.jsonfrom~/.omp/pluginstohome/omp/plugins/(home/omp/plugins-capture.sh).- It writes nothing and exits 1 when a file holds a token, a URL, an absolute path, a local or git source (
file:,link:,workspace:,github:,git+...) or a registry other than the default, since the files are public and the VM has no.npmrc. - The lock file may hold nothing but what omp writes (per plugin a version,
enabledandenabledFeatures; emptysettings). A free-form value, such as a plugin's own key, matches no token shape, so anything else is refused. - It drops lock entries of plugins that are not dependencies (stale), and sets each lock version to the one installed on disk (otherwise
omp plugin doctorreports lock drift as an error). node_modulesis never copied: it holds the Mac's native binaries, andbun installresolves the Linux ones frombun.lock.- The three files are placed in
~/.omp/pluginsas writable files (omp rewrites them; same rules as the omp config above, see Config). - The user service
omp-plugins-installrunsbun install --frozen-lockfilethere when their hash is new. The stamp is~/.local/state/dotfiles/omp-plugins.stamp, written only after a successful install, so a failure is retried: up to 5 times an hour, and at the next boot. - It is
Type=simple, so a deploy does not wait for the first install (about a gigabyte). Follow it withjournalctl --user -u omp-plugins-install. - bun's download cache lives in
~/.omp/plugins/.bun-cacheand is removed after each run. - bun, node and
harper-cli(whichpi-harper-grammarruns) come from nixpkgs-unstable: nixos-25.11'sharperbuildsharper-lsonly. - Plugins installed by hand on the VM (
omp plugin install) changepackage.jsonthere and stay until a new capture replaces it (the old file is kept as.dotfiles-backup).
vm-syncmirrors every directory of~/.skills-manager/skillsthat holds aSKILL.md(not hidden, not a link) into~/.omp/agent/skillswith rsync, one directory at a time, exactly inside it (--deletethere and nowhere else).- Nothing else in
~/.omp/agent/skillsis touched or deleted. ~/.omp/agent/managed-skills(the auto-learned store, with infra notes) is never read, copied or listed: a source path or a library member that resolves to amanaged-skillspath is refused.- No skill is in this repo.
- The skills piece also puts on the VM what those skills run:
ffmpegandffprobe(nixpkgs'ffmpeg-headless, which has libx264 for HyperFrames' H.264 renders), at a low priority, so a host that has its ownffmpegkeeps it first on the PATH;heygen, HeyGen's CLI, which HyperFrames' media-use runs for HeyGen's catalog of music, images and icons. Like omp it is a pinned seed (modules/nixos/agent-dev/heygen.nix, the Linux release archive, its hash checked against the release'schecksums.txt) that Home Manager copies once to~/.local/bin/heygen, whereheygen updatecan replace it. The rules of A pinned seed, and a copy that is yours apply;HYPERFRAMES_BROWSER_PATH=/opt/google/chrome/chromein every zsh (~/.zshenv), when the browser piece is on too: HyperFrames renders with that piece's Chromium. On NixOS its own Chrome download cannot start (nix-ld lacks Chrome's libraries) and that Chromium is on no PATH. It renders through HyperFrames' slower screenshot capture;HYPERFRAMES_NO_TELEMETRY=1andHEYGEN_NO_ANALYTICS=1in every zsh (~/.zshenv). HyperFrames and HeyGen's CLI report usage by default (HyperFrames' counters are linked to the HeyGen account once a key is saved), and HeyGen's CLI ignoresDO_NOT_TRACK. A process that zsh did not start does not see them, so on a new VM also runhyperframes telemetry disableandheygen config set analytics falseonce.
- HyperFrames does not read
~/.omp/.env, and omp does not pass that file to the commands it runs. For HeyGen's catalog, save the key into HyperFrames on the VM once (after the two commands above):node ~/.omp/agent/skills/hyperframes/scripts/plugin-cli.mjs auth login --api-keyasks for it at a hidden prompt, or reads it from a pipe. It lands in~/.hyperframes/credentials(mode 600); a new key means running it again.
Before the switch, vm-deploy runs the removal as the agent user.
- Exactly what the sync placed goes: the files and skill directories the sync recorded in
~/.local/state/dotfiles/vm-sync/manifest(including the Hindsight file), and the plugin install~/.omp/pluginsas one directory with its install stamp and the records of its three files. - A file of yours that the sync displaced (
hindsight.env) comes back, and directories the sync made are removed while empty. - The helper acts only on the few entries the sync records (an edited manifest cannot point it at another file).
- If a removal fails, the helper says which, exits 1 and keeps the manifest and the records for a retry, and the deploy stops before the role changes.
- If the switch itself then fails, the synced files are already gone:
vm-deploysays so. Fix the cause and runjust vm-deploy <name>again (to stay an agent, set the role back toagentfirst: that deploy syncs again). - Nothing else in the home changes (omp's config,
~/.omp/.env,~/.config/gh, anything you made). A plugin you installed by hand into~/.omp/pluginsgoes with that directory. - Flipping back to
agentplaces everything again (the plugin install downloads again).
- The LAN address in the committed omp config cannot be reached from the VM. The public Hindsight API sits behind an API-key gate instead (header
Authorization: Bearer <key>: 200 with a good key, 401 with none or a wrong one). - omp reads
HINDSIGHT_API_URLandHINDSIGHT_API_TOKENfrom the environment beforeconfig.yml. Measured on the VM with omp 18.8.6 against a fake server: the URL and key of the environment won overhindsight.apiUrl. So the sync sets those two variables and touches neither~/.omp/.envnorconfig.yml. - There is one entry per VM and one key per VM (so that it can be revoked alone). You store them in the
dotfiles-infraproject as the JSON mapVM_HINDSIGHT(VM name to{"url": "https://…", "token": "…"}; optional, the manifest default is{}). - Store one without the key reaching a command line or the shell history:
read -rs key; secretspec get VM_HINDSIGHT | KEY=$key U=<url> jq -c --arg n <name> '. + {($n): {url: env.U, token: env.KEY}}' | secretspec set VM_HINDSIGHT; unset key. The pipe keeps the old map off the terminal; never runsecretspec getwith its output on the terminal.
- On the Mac,
infra/vm-hindsight-health.pysendsGET <url>/healthwith the key (verified TLS, no proxy, no redirect followed, URL and key on stdin only). Anything but 200 stops the sync with a message and writes nothing for this piece (a file that is already there stays as it was). - It writes
~/.config/dotfiles/hindsight.envfor the agent user over ssh stdin: mode 600, its directory 700, the URL and the key as twoNAME='value'lines under a comment that says vm-sync wrote it. - The
.zshenvof Home Manager exports both (set -a) in every zsh: the ssh login shell,ssh host commandand Tern sessions. A process that is not started by zsh (a systemd user unit) does not see them.
With no entry for the VM, the file is removed and vm-sync prints one line (hindsight: no entry for <name> in VM_HINDSIGHT, removed …). A file of that name that vm-sync did not write is left alone. The flip to clean removes the file.
The same key lives in two OpenBao places:
- the property of that client in
secret/apps/hindsight-api-keys(an ExternalSecret copies it into the cluster about every minute, then Envoy takes a few seconds); - the VM's entry in
VM_HINDSIGHT.
Every bao command here needs export BAO_ADDR=https://openbao.home.0dl.me and a token from just openbao-login (bao reads ~/.vault-token). The client's property is named vm-<name> after the VM.
Revoke:
bao kv metadata get -mount=secret apps/hindsight-api-keys, and find the newest version<V0>that does not hold the VM's property and with no other property added after it.bao kv rollback -mount=secret -version=<V0> apps/hindsight-api-keys. Neverbao kv putwith a partial set. If another client's key was added after<V0>the rollback would delete it; then read the set into a mode-600 file, drop the one property and put the rest back from the file (untested).- Wait up to a minute and a few seconds. Then
GET /healthwith the old key must be 401 while the other clients' keys still give 200. - Optionally
bao kv destroy -mount=secret -versions=<versions that held it> apps/hindsight-api-keys. - Remove or replace the VM's entry in
VM_HINDSIGHT(the nextvm-syncthen removes the file, or writes the new key after its health check).
Mint a key: umask 077; openssl rand -hex 24 | tr -d '\n' > <key file>, then bao kv patch -mount=secret apps/hindsight-api-keys vm-<name>=- < <key file> (patch, never put; the key comes from stdin and has no newline). The same file feeds VM_HINDSIGHT: use read -r key < <key file> in place of the read -rs key above, then delete the file.
Rotate: add the new property, update VM_HINDSIGHT, run just vm-sync <name>, then revoke the old property as above (the gate must answer 401 for it).
- The key is in the environment of every shell and process of the agent user and in a mode-600 file. Anything that runs as that user can read it (so can its other processes through
/proc). - The gate does not name the client in its access log, and nothing here verifies per-key scoping inside Hindsight: assume every key has the same access.
- Cloudflare's 100 second limit can cut a long reflect call.
- With per-project tagged scoping, the VM's projects can be tagged differently from the Mac's paths, so memories from the VM land under other tags.
Option dotfiles.agent.mason.enable, on when the agent is. It is not a sync piece: no vm-sync, nothing in /etc/dotfiles-agent-sync.json, and the sync options do not switch it.
- omp's LSP tool starts a server when the server's command is on its
PATH. The captured pluginpi-mason-bridgeputs~/.local/share/nvim/mason/binon omp'sPATH. Measured in its installed source: it prepends$MASON/bin(default that directory) once when a session loads its extensions, before omp resolves its LSP config, and does nothing when the directory is missing. So a session that started before the first install has to be restarted to see the servers. - The VM gets that directory from a minimal Neovim:
pkgs.neovim(0.11.7) andpkgs.vimPlugins.mason-nvim(2025-11-14) of nixos-25.11, an init file in the Nix store (home/linux/mason-init.lua) that sets the runtime path to mason.nvim and Neovim's own runtime and loads mason.nvim and nothing else, and a user service. - Nothing else of Neovim comes with it:
- no
~/.config/nvimis created, read or changed (the init file does not read it, andjust test-rolespins that); - no other plugin;
- no Mason package outside the LSP category (so no formatter, linter or debugger of Mason). The one tool from outside Mason, by decision, is
shellcheckfrom nixpkgs on lex's loginPATH, for the diagnostics ofbash-language-server; - Neovim is on no
PATH(the unit names it by store path).
- no
just mason-capture (on the Mac) reads ~/.local/share/nvim/mason: the receipt of each installed package (packages/<name>/mason-receipt.json, which Mason writes when an install is finished) and the registry (registries/github/mason-org/mason-registry/registry.json) for the categories. It writes home/omp/mason-lsp.txt (home/omp/mason-capture.sh): package names, sorted, one per line, and nothing else (no version, no path).
- A package is in when it is in Mason's LSP category, one of the executables it links is, letter for letter, the command of one of the 55 built-in servers of omp 18.8.7 (
home/omp/lsp-builtins.txt), and it is not inhome/omp/mason-lsp-skip.txt(<package> <reason>per line). - omp has no command that lists its built-in servers, so
home/omp/lsp-builtins-extract.sh <omp binary>reads the table out of the compiled binary, where it is JavaScript text. Run it again after an omp bump:just test-infrafails while the version in the first line oflsp-builtins.txtdiffers from the one inmodules/nixos/agent-dev/omp.nix. - The capture refuses (exit 1, nothing written) a name that is not a plain package name (
[a-z0-9][a-z0-9._-]*, which every one of the 600 registry names is), a receipt that names another package than its directory, a registry that is not a list of packages, and an empty result. It prints what it left out and why. - Mason installs the registry's current version of a package on the VM, like mise's
latest; the list carries no version. - Review
git diff, commit, thenjust vm-deploy <name>.
bash-language-server, biome, css-lsp, dockerfile-language-server, emmet-language-server, gopls, helm-ls, html-lsp, json-lsp, lua-language-server, marksman, nil, pyright, ruff, rust-analyzer, svelte-language-server, tailwindcss-language-server, vue-language-server, yaml-language-server.
biomeandruffare in Mason's LSP category and omp has servers for them (it treats them as linter servers), so the rule takes them. Drop one by adding it to the skip list.- omp starts a server in a project directory only when one of the server's root markers is in that directory (
go.modfor gopls,Cargo.tomlfor rust-analyzer,pyproject.tomlfor pyright,.gitfor bash-language-server and yaml-language-server, and so on; measured in the binary). - A server that works through its language's tools (gopls: go, the npm servers: node, rust-analyzer: cargo) finds them in mise at run time.
Measured on the VM with omp 18.8.6, the real plugin discovery and a throwaway project per server:
- omp's
lspstatus lists the server of every project with the bridge on, and none of the Mason servers withomp plugin disable pi-mason-bridge. Re-enabled: the same lists again. omp rewrites the plugin lock file when it is toggled, with the same plugins and flags and without the final newline of the repo copy, whichwritable-copykeeps as it is. - All 19 answer an LSP
initializeover stdio. - Diagnostics of a deliberate error come back for gopls, pyright, ruff, rust-analyzer, biome, yaml, lua, marksman, dockerfile, svelte and nil.
The Mac gives the same picture with the same projects. The differences: rust-analyzer's error came back on the VM only, svelte's call was aborted on the Mac only, and bash-language-server's diagnostics came back on the Mac only until the role installed shellcheck.
vue-language-server,helm-lsandemmet-language-serverend with "Operation aborted" on both.json-lsp,css-lsp,html-lspandtailwindcss-language-serveranswer "OK" without a diagnostic on both. So for those four the proof is theinitializeanswer and the status listing only.bash-language-servertakes its diagnostics fromshellcheck: the option putsshellcheck(nixpkgs, 0.11.0) on lex's login PATH, which omp inherits, and not on the PATH of the install unit. Mason's ownshellcheckis a linter and is not captured.
These are in home/omp/mason-lsp-skip.txt (measured on the VM):
elixir-lsinstalls (a zip of shell scripts) but its launch script stops withcommand not found: elixir(Erlang/OTP and Elixir are not on the VM).omnisharpis the .NET build, which stops withexec: dotnet: not found. Mason links it asOmniSharpwhile omp looks foromnisharp, which the Mac's case-insensitive disk hides and Linux does not.astro-language-serveranswersinitializeonly when given the init optiontypescript.tsdk, which omp does not send. So omp reports "all language servers failed (astro)" on the VM and on the Mac alike. A project's.omp/lsp.jsoncan setservers.astro.initOptions.typescript.tsdk, then install the server by hand: the same headless command as the service, withMasonInstallinstead. The service never uninstalls, and never puts back what you removed while the list is the same.
A server that was installed before it went on the skip list stays on omp's PATH until you remove it:
MASON_NVIM=<mason.nvim> <nvim> --headless -u <init.lua> -i NONE --noplugin "+MasonUninstall <name>" +qa, where the three store paths are insystemctl --user cat mason-lsp-install(MasonUninstallblocks and exits 0; measured);- or delete
~/.local/share/nvim/mason/packages/<name>and its link in~/.local/share/nvim/mason/bin.
The first deploy after astro left the list needed this once on the VM.
docker-compose-language-service, harper-ls (the VM's grammar checks use the harper-cli of the plugin pi-harper-grammar), htmx-lsp, lemminx, stylua, taplo, templ, tflint and vtsls. omp would never start them, so the capture leaves them out and says so.
The user service mason-lsp-install (home/linux/mason-lsp-install.sh):
- It has
Type=simple, so a deploy does not wait for the first install (about 900 MB downloaded and unpacked, 100 s on the VM). It is wanted bydefault.target, and is retried after a failure (60 s apart, five times an hour, and again at the next boot), like the plugin install. - The hash of
mason-lsp.txtis part of the unit, so a changed list restarts it at the next deploy. A stamp (~/.local/state/dotfiles/mason-lsp.stamp) written only when every package is there keeps a boot with nothing new from installing anything. - Only packages with no receipt are installed, each by its own
nvim --headless -u <init.lua> -i NONE --noplugin "+MasonInstall <name>" +qa. In headless modeMasonInstallwaits until the install is done and makes nvim exit with status 1 when it failed (read in mason.nvim'slua/mason/api/command.luaand measured). A package the registry no longer has aborts that run with status 1, and one failing package must not hide the others, so the receipt of each package is checked after its run as well. - Nothing is ever uninstalled: a server that you install by hand with Mason stays, and so does one that dropped out of the list.
journalctl --user -u mason-lsp-installshows what it did. After five failed starts within an hour the unit rests until the next boot;systemctl --user reset-failed mason-lsp-install && systemctl --user start mason-lsp-installtries again.- A session of omp that started before the install finished has to be restarted.
- A listed server that you remove by hand is not put back while the list is the same (the stamp matches), but a wiped
packagesdirectory is rebuilt, as the plugin install rebuilds a missingnode_modules. - The service writes under
~/.local/share/nvim/mason(Mason's data, where the bridge looks),~/.local/state/nvim(its two log files) and~/.local/state/dotfiles(the stamp). - npm, go and cargo caches, nvim's own cache and go's telemetry file go to a work directory under
~/.cache/dotfiles(throughXDG_CONFIG_HOME,XDG_CACHE_HOME,npm_config_cache,GOPATH,CARGO_HOME). It is removed at the end, also after a failure and also when a killed run left one: they were about 900 MB.
It is exactly what the installs of the listed servers run. Measured by installing all of them with that PATH and by taking away, one at a time, curl, gzip, tar, getconf, node and go:
curl: registry and release assets. Without itMasonInstallsays the package is not valid.gzipandtar:rust-analyzeris a.gz,ruffis a.tar.gz.getconf: Mason takesgetconf, thenldd, to tell glibc from musl, and without either it calls NixOS an unsupported platform (rust-analyzer,lua-language-serverandhelm-ls).- node with npm (12 packages).
- go (
gopls): gopls 0.23 needs Go 1.26 and nixos-25.11 has 1.25, so go downloads go1.26.9 into the work directory at each install (GOTOOLCHAIN=auto). - For
nil, which Mason builds from a git tag:cargowithrustc, a C compiler,gitandnix. The build ran with those five together, and withoutnixit fails ("Isnixaccessible?", its build script runs it). The other four are cargo's own requirements and were not taken away one at a time. bashandcoreutilsare for the script itself.
Not needed, measured: unzip (no package of the list is a zip; Mason refreshes its registry without it), python and its venv (no package of the list comes from PyPI), a second compiler.
The Rust toolchain is the cost of nil: rustc and cargo are 1.6 GiB of closure (the VM's system closure was 3.1 GiB).
- A later
just mason-capturerefuses a package whose source (pkg:pypi,pkg:gem,pkg:nuget, ...) thisPATHhas no tool for, and names it. Skip it, or growtoolPackagesand the expected list ininfra/roles-check.shfirst. Apkg:githubpackage whose Linux asset is a.zipor.tar.xzneedsunziporxz, which the capture cannot see. - To drop
nil: addnil <reason>tohome/omp/mason-lsp-skip.txt, runjust mason-capture, and takepkgs.cargo,pkgs.rustc,pkgs.gcc,pkgs.gitandpkgs.nixout oftoolPackagesinmodules/nixos/agent-dev.nixand out of the expected list ininfra/roles-check.sh.
vm-deployleaves~/.local/share/nvim/masonand the stamp where they are, and says nothing about them.- It is the data directory of any Neovim, and a Neovim config that you may put in
~/.config/nvimlater would use it. - Unlike
~/.omp/plugins(which only the plugin install fills, and which the removal recognises by the records of the files placed there), nothing records which files in it are the service's. So removing the directory could remove what you installed by hand. - It is listed with the other leftovers under Agent to clean. A flip back to agent finds the packages there and installs nothing.
vm-deploydoes stop a running install before the switch, as it does for the plugin install, so that none goes on as the removed user.
NixOS runs no cloud-init (the module is off and the package is not in the system closure). So nothing on a cloud-init drive (user data, scripts, boothooks, part handlers) can act on the VM. The Proxmox drive only serves the Debian bootstrap stage.
vm-install writes the identity into the new system from the VM's TF_VAR_vms entry, after checking each value (they end up inside a unit file):
/etc/hostname(the name);/etc/systemd/network/10-static.network:[Match] MACAddress=<mac>, so the NIC's name does not matter;[Network]Address=<ipv4>/<prefix>,Gateway=<gateway>, oneDNS=<resolver>per entry ofdns;- for the initrd,
/etc/secrets/initrd/10-initrd.network.
NixOS leaves the first two alone: the role sets no hostName (do not set one: NixOS would replace /etc/hostname with a symlink) and defines no networkd unit.
/etc/systemd/networkd.conf is the exception. The role sets ManageForeignRoutes=false and ManageForeignRoutingPolicyRules=false there, and keeps IPv6PrivacyExtensions=true. networkd otherwise deletes routes and policy rules that are not in a .network file when it reloads, and a change of that file restarts networkd at switch. strongSwan on a guest installs its routes and policy rule 220 that way. Measured 2026-11-10: those two survived the restart, and the virtual IP addresses on the NIC did not. ipsec down/up puts the addresses back. The same file reaches every guest at its next vm-deploy; a guest with no such routes is unchanged.
- Changing
ipv4_cidr,gatewayordnsinTF_VAR_vms, oripconfig0,nameserverorsshkeyson the Proxmox VM, does not change the running VM, also not across a reboot. The drive stays attached and OpenTofu keeps maintaining it for the Debian stage; NixOS never reads it. Measured: a throwaway key set assshkeysand a different unusedipconfig0reached the drive and had no effect on the guest. macis different. It is the NIC's hardware address (network_device), and both network files match on it, so applying a new one should leave the next boot without network, not even in the initrd (expected from the match; not measured). Reinstall for a MAC change, or put the newMACAddress=into both files (steps 1 and 2 of Change the address, gateway or resolver) before you apply it. That variant was not exercised.- There is no search domain. A search domain that the Proxmox host's resolver settings put on the drive is not carried over (it never came from the VM entry); names resolve with their full domain.
Do this in the order below. The VM stays reachable at its old address until step 3. vm-deploy and vm-unlock read the address from the OpenTofu state, which follows TF_VAR_vms only after just infra-apply.
- As root over SSH, edit the
Address=,Gateway=andDNS=lines of/etc/systemd/network/10-static.networkand/etc/secrets/initrd/10-initrd.network. Keep mode 0644. just vm-deploy <name>: it rewrites the initrd from the edited initrd file. Nothing reloads networkd, so the running address does not change.rebooton the VM.- Change the entry in
TF_VAR_vms, thenjust infra-planandjust infra-apply(only the drive changes; the provider may reboot the VM, which then waits in the initrd). just vm-unlock <name>.
If the VM is not reachable afterwards, type the passphrase on the serial console and see Recovery. This sequence was not exercised as a whole; the two files and the reboot and unlock path were.
To change the name, reinstall. The entry's key is the Proxmox VM name, the hostname and the key of both vault maps, and OpenTofu replaces the VM when the key changes: Remove a VM, then Add a VM with the new name (the new name gets a new disk passphrase). Editing /etc/hostname alone renames only the guest and leaves it out of step with its entry.
A VM installed with an earlier version of this role (cloud-init on NixOS) must be reinstalled before vm-deploy of the current role. It has no 10-static.network (its network came from cloud-init, which the current role removes), so it would come up without network at the next reboot.
If you do not want to reinstall, write /etc/hostname and /etc/systemd/network/10-static.network by hand first, with the content described above. Mind that the initrd file (/etc/secrets/initrd/10-initrd.network) already exists from that install.
The disk has:
- a BIOS boot partition;
- an unencrypted 1 GiB ext4
/boot(kernel, initrd, initrd secrets; GRUB on SeaBIOS never touches LUKS); - a LUKS2 root (
cryptroot,aes-xts-plain64; TRIM is not passed through, because it would show which blocks are free).
GRUB keeps 5 generations so /boot cannot fill up.
VM_LUKS_KEYSmaps<name>to a generated 64-hex-digit passphrase.vm-installcreates it on the first install of a name and keeps it across reinstalls. It writes it to OpenBao before the disk is touched and passes it to the installer as a file in a 0700 temp directory (nixos-anywhere --disk-encryption-keys).VM_INITRD_HOST_KEYSmaps<name>to the public key of the initrd's SSH host key. Every install makes a fresh key pair and stores the public half first.- Both maps are updated by read-modify-write, and the entries are checked again right before the disk is formatted. But run one
vm-installat a time: two at once can overwrite each other's entry.
- The initrd runs systemd with networkd and an SSH server on port 2222.
- Its static address, its SSH host key and its authorized keys are not in the repo or the Nix store.
vm-installplaces them on the new system (nixos-anywhere --extra-files):/etc/secrets/initrd/10-initrd.network(MAC, address and gateway of the VM entry),/etc/secrets/initrd/ssh_host_ed25519_key, and/root/.ssh/authorized_keys(the key list fromTF_VAR_ssh_authorized_keys, also root's key list in stage 2). - The bootloader step (
boot.initrd.secrets) copies them into the initrd, which sits on the unencrypted/boot. - The initrd's address is cleared before switch-root, so stage 2 configures the NIC from scratch from its own file.
- The initrd's address is the third identity file (see Identity: fixed at install): it is written at install and neither
vm-deploynor a change ofTF_VAR_vmstouches it.
After vm-install, a reboot, or a restart of the Proxmox host (on_boot), the VM stops in the initrd until the passphrase arrives. Nothing unlocks it unattended, by design.
just vm-unlock <name>:
- connects to port 2222 with the pinned host key (a throwaway
known_hosts, strict checking; a mismatch aborts and is never retried); - finds the pending passphrase query and answers it with
systemd-reply-password. The passphrase goes over a pipe (not argv, no tty, nothing echoed); - retries for up to
VM_UNLOCK_TIMEOUTseconds (default 300) while no query is pending, then waits up toVM_UNLOCK_BOOT_TIMEOUTseconds (default 120) for port 22; - treats port 2222 still being open 45 s after the answer as a refusal: the initrd asked again, so the passphrase was refused;
- exits at once, with nothing sent, when the VM already answers on port 22 and not on 2222.
qm terminal <vmid>on<node>shows the promptPlease enter passphrase for disk cryptroot:. Type the passphrase there (read it withsecretspec get VM_LUKS_KEYS | jq -r '.["<name>"]'in a terminal you trust).- An empty Enter counts as one of the three tries.
- Root has no password, so the console cannot log in.
- This works when the initrd's network does not, for example after the VM's address changed.
- LUKS2 derives the key with Argon2id, and cryptsetup peaked at 1 GiB of memory at unlock (measured on a 4096 MB VM). Keep
memory_mbat 2048 or more, as the installer already needs (see Add a VM). - A larger
disk_gblater enlarges the virtual disk only: NixOS runs no growpart or resizefs (there is no cloud-init), and the root is a LUKS partition anyway. - Growing the partition, the LUKS mapping and the file system works on the running VM: see Grow the disk (measured).
So nobody over-reads this: it protects the data on the disk image, its snapshots and backups. It does not protect against:
- someone who can change
/boot(they can replace the initrd with one that records the passphrase you type, and the initrd's SSH host key is readable there); - a hypervisor administrator who can read the VM's memory or attach boot media;
- losing the passphrase: it is the only way to unlock, so no copy of it (in OpenBao, or offline: see Offline copies) means no data.
The user-data path is closed: NixOS runs no cloud-init, so nothing a Proxmox user can put on the cloud-init drive (a custom cicustom snippet included) can run at boot.
OpenBao holds the only copy of three values of this stack, and no recipe makes another. You make the copy by hand, once, and again when a value changes.
VM_LUKS_KEYS: the disk passphrase of each VM. Lost, the data of every VM is gone (one keyslot, no header backup). The console fallback andvm-unlockread it from the vault too, so with OpenBao down a rebooted VM stays locked. With the copy,jq -r '.["<name>"]' <offline path>/vm-luks-keys.jsonprints the passphrase to type on the console (run it in a terminal you trust).TF_VAR_tofu_state_passphrase: lost, the state object and every backup of it are unreadable (The object no longer decrypts).VM_INITRD_HOST_KEYS: public keys, so no data is at stake. Lost,vm-unlockhas no key to pin and stops. Unlock on the console, then put the key back (not exercised):ssh root@<ipv4> 'ssh-keygen -y -f /etc/secrets/initrd/ssh_host_ed25519_key' | cut -d ' ' -f 1,2prints it (cutdrops the comment that-yadds), andsecretspec get VM_INITRD_HOST_KEYS | jq -c --arg n "<name>" --arg k "<public key>" '. + {($n): $k}' | secretspec set VM_INITRD_HOST_KEYSstores it.
Make the copies on encrypted or offline media, never in the repo or in a synced folder: the files hold the secrets in clear. The redirects keep the values off the terminal, and umask 077 makes the files private (same exported environment as in secretspec conventions):
umask 077
secretspec get VM_LUKS_KEYS > <offline path>/vm-luks-keys.json
secretspec get TF_VAR_tofu_state_passphrase > <offline path>/tofu-state-passphrase.txt
secretspec get VM_INITRD_HOST_KEYS > <offline path>/vm-initrd-host-keys.jsonCheck a copy without showing it: secretspec get VM_LUKS_KEYS | shasum -a 256 | cut -c1-12 and shasum -a 256 < <offline path>/vm-luks-keys.json | cut -c1-12 must print the same twelve characters.
Restore from stdin: the value comes back unchanged (see secretspec conventions). VM_LUKS_KEYS must hold the passphrase the disk was formatted with; vm-install keeps an existing entry:
secretspec set VM_LUKS_KEYS < <offline path>/vm-luks-keys.json
secretspec set TF_VAR_tofu_state_passphrase < <offline path>/tofu-state-passphrase.txt
secretspec set VM_INITRD_HOST_KEYS < <offline path>/vm-initrd-host-keys.json- Use the serial console:
qm terminal <vmid>on<node>. - If the VM sits at
Please enter passphrase, runjust vm-unlock <name>, or type the passphrase there. - At the GRUB menu (serial too) pick an older generation to roll back a kernel or role problem, then fix the role and
just vm-deploy <name>. That does not help with the identity files (next section).
This happens after a NIC or MAC change, or when the identity files are wrong. The initrd still answers if its own file is right and the console prompt always works, but root cannot log in on the console.
GRUB's older generations do not help, because /etc/hostname and /etc/systemd/network/10-static.network belong to no generation, and no generation has cloud-init to bring the network back (it is not installed on NixOS). So either:
- reinstall (Reinstall); or
- boot a rescue image from Proxmox (attach an ISO, boot it), open the volume (
cryptsetup open /dev/disk/by-partlabel/disk-main-root cryptroot, with the passphrase), mount it, fix the two files (mode 0644), unmount, close and boot again. The rescue path was not exercised.
The initrd at that address does not present the key vm-install pinned. vm-unlock never retries. Check that the address belongs to <name>, then use the console. A reinstall pins a new key.
Recreate the VM, clear its old host key, wait for Debian to boot, then install again and unlock.
- The recreated Debian has a new host key. Without
ssh-keygen -R, thevm-installguard refuses the changed key (its message names this cause, next to "still booting" and "already NixOS"). - The disk passphrase of
<name>is kept; the initrd host key is new. - A reinstall formats the disk: everything in the VM's home is gone (the
~/.omp/.env, theghlogin, Tern, mise's tools, containers). The repo and the vault hold the rest.
just infra-apply "-replace='proxmox_virtual_environment_vm.vm[\"<name>\"]'"
ssh-keygen -R <ipv4>
just vm-install <name>
just vm-unlock <name>A new VM also has new keys, and what holds the old ones needs a step each. For the role agent:
Run ssh root@<ipv4> true. The VM's console has no login, so what you check is that the address belongs to the VM. Then run just vm-deploy <name>. The install itself syncs nothing (Hindsight file, skills, plugins); the deploy does.
just vm-jumphost-authorize <name>(and… <name> shell) appends the new key's line next to the old one (both carry the comment<name> docker-jumphost, or<name> shell-jumphost) and never removes a line. So the old key stays valid until you delete its line. Do it for each key that the old VM had authorized.- The authorize script prints the new key's fingerprint.
- List the fingerprints on the jumphost, then delete the old line by its fingerprint with the script below. Without the old VM, the old key is the other line with the same comment.
- The removal script backs the file up first (
authorized_keys.bak-<timestamp>), deletes exactly one line, and stops without a change when the fingerprint matches no line or several. Never give it the new fingerprint.
ssh jumphost_server 'ssh-keygen -l -f ~/.ssh/authorized_keys' # one line per key, with its comment
old='SHA256:<fingerprint of the old key>'
ssh jumphost_server "OLD='$old' sh -s" <<'EOF'
set -eu
ak=$HOME/.ssh/authorized_keys
cp -p "$ak" "$ak.bak-$(date -u +%Y%m%dT%H%M%SZ)"
tmp=$(mktemp "$HOME/.ssh/authorized_keys.new.XXXXXX")
n=0
while IFS= read -r line || [ -n "$line" ]; do
fp=$(printf '%s\n' "$line" | ssh-keygen -l -f - 2>/dev/null | awk '{print $2}') || fp=
if [ -n "$fp" ] && [ "$fp" = "$OLD" ]; then n=$((n + 1)); else printf '%s\n' "$line" >>"$tmp"; fi
done <"$ak"
if [ "$n" -ne 1 ]; then echo "matched $n lines, expected 1: nothing changed" >&2; rm -f "$tmp"; exit 1; fi
chmod 600 "$tmp"
mv "$tmp" "$ak"
echo "removed 1 line"
EOFDo this if you use Tern.
- The Mac's Tern keeps one pin per VM in
~/Library/Application Support/Tern/known_hosts(a line<ipv4>:8376 SHA256:<fingerprint>; Tern 0.7.0). - It keeps its host list in
~/Library/Application Support/Tern/hosts(<user>@<ipv4>; a VM whose Tern started before the drop-in can also have a<user>@<endpoint id>line). - The new VM has a new Tern host key, so the old pin is stale. Delete that line from
known_hosts, delete a stale<user>@<endpoint id>line fromhosts, then runtern remote setup <user>@<ipv4>again. tern remote trust HOST FINGERPRINTpins by hand andtern remote host-key --useron the VM prints its fingerprint. Both are fromtern remote's usage text; they were not run here, and what Tern says about a stale pin was not captured.
Both were on the old disk; do them again (see Personal setup).
Rerun just vm-install <name>.
Plan, apply, vm-install and vm-deploy fail before they change anything. vm-ip says it could not read the VM list from the state (ignore any "no VM named" text from older versions). Retry when the store is back.
This happens on a reboot or a network drop. OpenTofu cannot save the new state. It writes it, encrypted, to errored.tfstate in its working directory, infra/proxmox/vms/.terragrunt-cache/<hash>/<hash>/ (find it with find infra/proxmox/vms/.terragrunt-cache -name errored.tfstate), and the lock object stays.
Do NOT rerun the apply (it plans the same VMs again) and do NOT delete .terragrunt-cache.
When the store is back:
- Force-unlock (Stale lock).
- Copy
errored.tfstateout (cp -p, keep mode 600). - Upload it as the state object (Restore the state object).
just infra-planmust show no changes for what was applied.
tofu state push does not work here: it refuses an encrypted file.
A crashed run can leave the lock object dotfiles-infra/proxmox-vms/terraform.tfstate.tflock. Force-unlock only when no run is active (the id is in the lock error):
cd infra/proxmox/vms && SECRETSPEC_FILE=../../secretspec.toml SECRETSPEC_REASON="dotfiles infra" secretspec run -- terragrunt force-unlock <id>Do this before applies that replace or destroy a VM; a timestamped name keeps the last good copy. Copy the object as is, to a private path outside the repo. Never tofu state pull into a file: that is decrypted plaintext.
SECRETSPEC_FILE=infra/secretspec.toml SECRETSPEC_REASON="dotfiles infra" secretspec run -- sh -c 'umask 077; aws --region us-east-1 --endpoint-url "$TF_STATE_S3_ENDPOINT" s3 cp "s3://$TF_STATE_S3_BUCKET/dotfiles-infra/proxmox-vms/terraform.tfstate" "$HOME/infra-state-$(date +%Y%m%dT%H%M%S).backup"'Use this when no run is active, after a lost or damaged object, or after an outage during an apply. Upload the encrypted file as is, then plan.
SECRETSPEC_FILE=infra/secretspec.toml SECRETSPEC_REASON="dotfiles infra" secretspec run -- sh -c 'aws --region us-east-1 --endpoint-url "$TF_STATE_S3_ENDPOINT" s3 cp <file> "s3://$TF_STATE_S3_BUCKET/dotfiles-infra/proxmox-vms/terraform.tfstate"'
just infra-planjust infra-plan must show no changes for what the file holds. What was applied after a backup shows as to-create: import it before any apply, then read what the plan still wants to change. This path was not exercised:
cd infra/proxmox/vms && SECRETSPEC_FILE=../../secretspec.toml SECRETSPEC_REASON="dotfiles infra" secretspec run -- terragrunt import 'proxmox_virtual_environment_vm.vm["<name>"]' <node>/<vmid>
# and per node: terragrunt import 'proxmox_download_file.debian["<node>"]' <node>/<datastore>:import/<file name>The ids are as in the bpg/proxmox 0.112 docs. The passphrase must be the one the file was written with.
This happens when the passphrase in OpenBao was lost or changed, or the object is damaged. Every command fails with a decrypt error, import included.
- Move the object aside first (same
secretspec run -- sh -c '…'form, withs3 mv "s3://$TF_STATE_S3_BUCKET/dotfiles-infra/proxmox-vms/terraform.tfstate" "s3://$TF_STATE_S3_BUCKET/dotfiles-infra/proxmox-vms/terraform.tfstate.unreadable"). - Then restore a backup made with the right passphrase, or import.
The passphrase lives in OpenBao and in any offline copy you made (Offline copies). Without one, losing it makes every backup unreadable too.
docs/SETUP.mdis a stub. This README is the setup path.just docs/just docs-serveexpect an mdbook tree that is not present.- Formatter is alejandra (
just fmt), not nixfmt. - Lint baseline: docs/EXEMPTIONS.md.