My dotfiles
dotfiles README.md
14 kB 317 lines
Markdown
at main

dotfiles #

Managed with GNU Stow and a Justfile inside the devenv shell. Each stow/<package>/ tree mirrors $HOME, so stow/fish/.config/fish/config.fish becomes ~/.config/fish/config.fish.

Commands #

Run these from the repo root. direnv normally puts you in the devenv shell; otherwise prefix them with devenv shell --:

just backup               # back up existing configs before the first install
just install              # stow + secrets + Claude skill links + Herdr files
just restow               # repair links after moving files
just check                # dry-run, report conflicts
just delete               # remove the managed symlinks
just secrets              # decrypt fish secrets if needed
just secrets-refresh      # force a re-decrypt
just link-claude-skills   # refresh ~/.claude/skills links
just herdr                # copy herdr/ (mods, layouts, keys.json) into the Herdr app
just reload               # reload niri and restart atuin
just sshd-install         # install the hardened sshd drop-in (sudo)
just                      # list recipes

just install runs just secrets first. The first run needs a YubiKey PIN and a touch; later runs skip while ~/.config/fish/secrets.fish is newer than the vault entry.

just install does not stop or restart services. Editing a tracked file is already live through the symlink; run just install only when the symlink tree itself changes (new files/packages, a pull that adds files, or repairing a link a tool replaced). After changing a service's config, just reload handles niri and atuin; restart OpenCode, Claude, nvim, and fish shells yourself. Do not stop OpenCode from inside an OpenCode session — that is the session running the command.

just install does not migrate an existing machine: it does no backup, does not stop services, and stow refuses to overwrite real files. The first install on another machine needs the one-time migration in MIGRATING.md.

YubiKey touch: after entering the PIN, touch the key when it blinks. age-plugin-yubikey does not print a touch prompt, so it can look like the command has stalled. There is nothing else to confirm; just touch the key. This works under just in the interactive devenv shell; it hangs under devenv tasks run because the task runner does not give the plugin an interactive terminal.

Secrets #

The fish API keys live in the devkit vault:

$SECRETS_DIR/dotfiles/fish/secrets.fish.age

just secrets decrypts that to ~/.config/fish/secrets.fish (mode 600). The plaintext file is gitignored and is never stored in this repo.

Skills #

Hand-written agent skills live in stow/skills/.agents/skills/<name>/. just install links them into ~/.claude/skills/, because Claude Code does not read ~/.agents/skills directly. Skills installed by devkit or other tools stay where those tools put them and are not tracked here.

Host-specific files #

  • Only stow/niri/.config/niri/cfg/keybinds.kdl is tracked. The rest of ~/.config/niri (config.kdl and the other cfg/*.kdl) stays local. On install, a stock keybinds.kdl is moved to keybinds.kdl.pre-dotfiles.<timestamp> and replaced with the tracked link.
  • ~/.config/niri/cfg/display.kdl is deliberately not tracked. It holds per-machine output names and modes; edit it with the output of niri msg outputs. just delete leaves it in place.
  • just niri-guard ensures ~/.config/niri is a real directory before stow runs, so stow cannot fold the package into a repo symlink. It also refuses to run if the old whole-directory symlink layout is still present.
  • ~/.config/fish/secrets.fish is local and gitignored.
  • fish_variables, opencode/service.json, atuin/data, jj/repos, jj/workspaces, SSH private keys, and generated ssh/config.d/servers-*.conf stay local and unmanaged.
  • atuin/config.toml still has an absolute /home/btburke/data cwd_filter; it assumes the same username on each machine.
  • mimeapps.list names desktop applications that may not exist everywhere; missing entries are harmless.

Remote SSH (pigeons) #

ssh lofoten from kiruna (and ssh kiruna from lofoten) runs over pigeons, which uses iroh to punch through NAT or fall back to a relay. Each machine runs:

  • sshd on loopback only (127.0.0.1:22), so nothing on the LAN or the internet can reach it directly. Login is public key only, and only the two YubiKey FIDO2 keys (fleet-yk5, fleet-yk4) with a touch. Source: system/sshd/10-hardening.conf.
  • pigeons roost as a systemd user service, which takes iroh connections and hands them to that sshd. Its identity key is ~/.ssh/pigeons_ed25519; the endpoint ID derived from it is the machine's address.

Tracked here: the user unit and telemetry_enabled = false (package pigeons), the Host lofoten kiruna block in ssh/.ssh/config.d/pigeons.conf, and the sshd drop-in. Not tracked: the endpoint IDs, kept one per file in ~/.ssh/pigeons-ids/<host> (mode 700). Anyone holding an ID can reach that machine's sshd, so treat them as private.

Setting up a machine #

Do this on both lofoten and kiruna, ideally at home with both side by side. Usernames must match (AllowUsers btburke in the sshd drop-in).

  1. Install pigeons. Use --locked: the crates.io 0.2.3 release does not build without its lockfile.

    cargo install --locked iroh-pigeons
    
  2. Link the configs. This also creates ~/.ssh/pigeons-ids/.

    just install
    
  3. Install the sshd drop-in. It generates any missing host keys, installs the file, and removes it again if sshd -t fails.

    just sshd-install
    
  4. Authorize both YubiKeys. The stubs ~/.ssh/fleet-yk5 and ~/.ssh/fleet-yk4 must already be on the machine you connect from.

    cat ~/.ssh/fleet-yk5.pub ~/.ssh/fleet-yk4.pub >> ~/.ssh/authorized_keys
    chmod 600 ~/.ssh/authorized_keys
    
  5. Start sshd.

    sudo systemctl enable --now sshd
    
  6. Let user services run at boot without a login, then start the roost.

    sudo loginctl enable-linger "$USER"
    systemctl --user daemon-reload
    systemctl --user enable --now pigeons
    
  7. Read this machine's endpoint ID, and its sshd host key fingerprint for step 9:

    journalctl --user -u pigeons -b | grep 'roost is running'
    ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub
    
  8. On the other machine, store that ID under this machine's name, e.g. on kiruna for lofoten:

    echo '<lofoten endpoint id>' > ~/.ssh/pigeons-ids/lofoten
    
  9. Connect, and check the host key fingerprint ssh shows against the one from step 7 before answering yes. Touch the YubiKey when it blinks.

    ssh lofoten
    

Back up ~/.ssh/pigeons_ed25519 (it is a private key). If it is lost, the roost makes a new one with a new ID and step 8 must be redone on the other machine.

Updating pigeons #

cargo install --locked iroh-pigeons
systemctl --user restart pigeons

The endpoint ID does not change on update.

Troubleshooting #

  • ssh -v lofoten: shows whether the tunnel or authentication failed. cat: .../pigeons-ids/lofoten: No such file means step 8 was skipped.
  • journalctl --user -u pigeons -f: incoming connections (pigeon arrived) and whether sshd was reachable.
  • sudo journalctl -u sshd -f: authentication; with LogLevel VERBOSE it names the key fingerprint used.
  • After editing system/sshd/10-hardening.conf, run just sshd-install, then sudo systemctl reload sshd.

Herdr #

herdr/ holds what this setup adds to the Herdr app:

  • mods/bug/: the Issues panel (below).
  • mods/jj/: the JJ panel (below).
  • mods/my-tabs/: a clone of Herdr's shipped tabs mod (0.1.16) with JJ and Issues buttons next to Files and Changes, and jj / issues commands for the keys. Its changes are marked ISSUES.
  • mods/my-new-menu/: a clone of the shipped new-menu (the tab bar's +): installed agents only, never Codex or Pi (HIDE), no worktree rows, and a Review section that opens the Jujutsu (j) or Issues (i) panel in a tab of its own, pinned to the focused terminal's folder. Its changes are marked MINE; my-tabs opens it.
  • mods/my-palette/: a copy of Herdr's command palette (frame/palette) with a Review group, Jujutsu and Issues, that opens them in a tab like the + menu does. ctrl-shift-p opens it (mod.open:my-palette); the status bar's "commands" still opens Herdr's own. Changes marked MINE.
  • layouts/my-main.json: a clone of the shipped main layout that uses my-tabs and adds jj and issues blocks to the right-hand panel.
  • themes/: Catppuccin Mocha and Latte, from herdr-t3's extras (Apache-2.0; the Catppuccin palette, MIT): mantle behind, base for cards, surface0 for selection and borders, blue accent.
  • settings.json: zoom 1.1 (terminal text 15.4px and every panel's text about 1px bigger than stock) and the theme pair, Latte in light mode and Mocha in dark. Zoom keys (ctrl-=, ctrl--) change it in the app; bring a new value back here or just herdr will show the diff.
  • keys.json: Herdr's keys plus ctrl-shift-j (JJ) and ctrl-shift-i (Issues), and ctrl-shift-p opening my-palette.

Everything is copied, not stowed: Herdr doesn't pick up or hot-reload a symlinked mod folder. Edit here, then just herdr copies the mods to ~/.config/herdr-app/mods/ and runs herdr-app check on each (the app reloads them at once), and copies the layouts and keys.json. A layout, keys.json or settings.json changed in the app since the last just herdr is left alone and its diff printed; bring the change into herdr/, or run HERDR_FORCE=1 just herdr to replace it. Machines without herdr-app skip the step. Pick the layout once with ctrl-shift-l (or herdr-app do layout.switch '{"name":"my-main"}').

The clones don't get Herdr's updates to main, tabs, new-menu and the palette. After an update, compare them with the shipped ones (~/.config/herdr-app/layouts/main.json, ~/.config/herdr-app/mods/tabs/main.js, ~/.config/herdr-app/mods/new-menu/main.js, ~/.config/herdr-app/frame/palette/main.js) and carry over what matters. Since keys.json is ours, new default shortcuts have to be added by hand too.

jj: JJ panel #

The jj log of the repository the focused terminal is in, drawn as jj log draws it (jj's own graph, in the terminal font), one line per change: bookmarks, tags, workspaces, (empty), conflicts. Pick a change to see its description, author, parent and files with line counts; pick a file (or [ / ]) for its diff. Click a change ID to copy it (y copies the selected one). Open it with the JJ button at the top right or ctrl-shift-j, or as a pane or dialog like the Issues panel ("mod":"jj").

Keys (the bar along the bottom lists the ones that apply): j/k move, Enter opens, y copy ID, n new change on the selected one (the selection follows the working copy), e edit, d describe (Ctrl+Enter saves), s squash into its parent, x abandon, b set a bookmark, w new devkit workspace from it (opened as a Herdr space), [ / ] step through the diffs, u undo, f fetch, p push (after a dry run you confirm), r snapshot and read again, Esc back. Immutable changes only offer what doesn't rewrite them. As commands: jj.<name> (next, prev, open, copy, new, edit, describe, squash, abandon, bookmark, workspace, nextfile, prevfile, undo, fetch, push, refresh, back).

Commands run through the project's own jj: devkit's wrapper in .devenv/profile/bin (so fetch and push sync bugs, and attribution in descriptions is refused), with that bin first on PATH; elsewhere, jj on PATH. w uses devkit's workspace add NAME --from CHANGE, so workspaces are never colocated. Reads pass --ignore-working-copy: the panel snapshots only when files outside .jj/.git changed, after its own commands, on first open and on r, so it doesn't fill the op log or race jj in a terminal.

bug: Issues panel #

The bug issues of the repository the focused terminal is in: open, closed or all, with sub-issues under their parent. Pick one to read it, with its description and comments rendered as markdown, comment on it, or close or reopen it. Click an issue's ID to copy it (y copies the selected one) and paste it into a prompt as bug abc1234. New starts an issue (optionally under the selected one); Sync runs bug sync. Wide panels show the list and the issue side by side; narrow ones show one at a time.

Open it with the Issues button at the top right or ctrl-shift-i (both toggle it in the right-hand panel), or:

herdr-app do pane.split '{"direction":"right","mod":"bug"}'   # beside the focused pane
herdr-app do mod.open '{"name":"bug"}'                        # as a dialog

Keys while it has the keyboard (click it; a bar along the bottom lists the ones that apply): j/k move, Enter opens, y copies the ID, c comments (Ctrl+Enter posts), x closes the issue (or reopens a closed one), n new issue, f cycles open/closed/all, r reads again, Esc goes back. The same names work as bug.<name> commands in keys.json (next, prev, open, copy, comment, close, new, filter, refresh, back).

It runs the repository's own bug (.devenv/profile/bin/bug in the checkout or the main workspace, else bug on PATH) and needs bug 1.6.0, which comes with devkit 1.9.0: in an older project it says to run devenv update devkit. Changes made elsewhere show up through a watch on the repository's refs/bugs (a 30-second poll for other machines). Props: folder (+ machine) pins it to one repository.

Adding a package #

  1. Create stow/<package>/ with the path tree you want under $HOME.
  2. Add "<package>" to packages in the Justfile.
  3. Run just check, then just install.