🫥 Mostly Nix dotfiles
Files
README.md

expede's Dotfiles #

NixOS configurations, with home-manager as a NixOS module. Hostnames are flowers.

Hosts #

Host Type Description
dahlia Desktop niri, AMD GPU, Jellyfin, restic server
kielo Server Headless, reachable over SSH and Tailscale
wisteria Laptop Framework 13, niri, fingerprint, YubiKey

All hosts are x86_64-linux.

Structure #

.
├── flake.nix           # mkSystem, hosts, checks, templates
├── home/               # Home-manager modules
│   ├── default.nix     # Entry point; servers skip the desktop modules
│   ├── agents.nix      # Claude Code, plus agents/ below
│   ├── agents/         # Sandbox, Pi, commands, skills, instructions
│   ├── astal.nix       # Bar, pickers, OSD and lock (astal/ is the TypeScript)
│   ├── desktop.nix     # Shared by graphical hosts
│   ├── doom/           # Doom Emacs configuration
│   ├── hosts/          # Per-host overrides
│   └── niri-session/   # Theming, lock, recording, swaync
├── nixos/              # System modules
│   ├── common.nix      # Every host
│   ├── desktop.nix     # Graphical hosts
│   └── hosts/          # Per-host system config and hardware
├── secrets/            # sops-encrypted secrets
├── templates/rust/     # Project template
└── wallpaper/

Rebuild #

The repo lives at ~/Documents/Soft/dots on the desktops. Rebuild from committed main, because agents can edit the working tree but can't commit. Read what they wrote before committing it. From the repo root (flake-rebuild-switch runs this from anywhere, and says which commit it builds):

sudo nixos-rebuild switch --flake '.?ref=main'

To try uncommitted work, flake-rebuild-test builds the working tree and activates it until the next reboot. Read git diff first. New files must be known to git, or the flake won't see them: git add -N <file> is enough.

Update inputs with nix flake update, or nix flake update nixpkgs for one.

After changing home/doom/init.el or packages.el, also run doom-conf sync.

Checks #

nix flake check         # Evaluate every host, lint, and look for plaintext secrets
agent-sandbox-probe     # Test the agent sandbox; run from inside a project

Agent sandbox #

claude and pi run in bubblewrap (home/agents/sandbox.nix). They see the current repo and their own state, but not your home directory, SSH agent, or the host's own services. They have outbound network, except to the local network, the tailnet and the host itself.

claude-host runs Claude unconfined, for work that needs the whole machine. It ignores the project's .claude/ settings, since a sandbox could have written them; after reading them, add --setting-sources user,project,local.

Pi's extensions are pinned in home/agents/pi-packages/ and built by Nix, so they're read-only at runtime. home/agents/pi.nix explains how to change one. Other writes to ~/.pi are discarded when pi exits, except logins, sessions and subagent memory.

Each sandbox has its own login, so run /login once. To give Claude other paths, set CLAUDE_SANDBOX_BIND=/path/one:/path/two. Repo metadata found under them at launch stays read-only, but their submodules' working trees don't.

.git is read-only in there, because the host's git executes what it names. git status, diff and log work; add, switch, stash and worktrees don't, so run those on the host. Commits and SSH pushes would fail anyway, because signing and SSH keys are absent. Submodules in the index are read-only too, and so is any other repo's metadata found at launch. The wrappers refuse a bare repo, and a directory that holds repos but isn't one. A repo created during a session isn't protected, so don't enter one with host tools unless you trust it.

Secrets #

sops-nix decrypts secrets/ at activation with each host's SSH host key. .sops.yaml lists who can decrypt what. To add a host, add its recipient there (nix run nixpkgs#ssh-to-age < /etc/ssh/ssh_host_ed25519_key.pub), then run:

sops updatekeys secrets/<file>

Backups #

wisteria backs up /home/expede with restic, to dahlia's REST server over Tailscale, or to the forget-me-not drive when it's plugged in. Both write the same repository. The server requires a login and is append-only. Pruning is by hand, because a stolen login could add snapshots that a scheduled prune would keep in place of yours: plug the drive into wisteria and run sudo backup-prune. A desktop alert fires when no backup has succeeded for three days. Check with the backup-status abbreviation.

wisteria also keeps 20 daily btrfs snapshots of / and /home. Space from deleted files returns only as those snapshots age out.

Initial setup #

  1. Boot the NixOS installer and partition disks at /mnt, following nixos/hosts/<host>/hardware.nix. New partitions get new UUIDs, so after cloning (step 2), regenerate it before installing: nixos-generate-config --root /mnt --show-hardware-config > nixos/hosts/<host>/hardware.nix. A reinstall also makes a new SSH host key, so add it under "Secrets" before the host's secrets can decrypt.

  2. Clone this repo and install:

    nix-shell -p git
    git clone https://tangled.org/did:plc:uzur2xk5bcmp54d6vjzrpwfy /mnt/etc/nixos/dots
    cd /mnt/etc/nixos/dots
    nixos-install --flake .#<hostname>
    
  3. After rebooting, move the repo home and rebuild:

    mkdir -p ~/Documents/Soft
    sudo mv /etc/nixos/dots ~/Documents/Soft/dots
    sudo chown -R $USER:users ~/Documents/Soft/dots
    cd ~/Documents/Soft/dots
    sudo nixos-rebuild switch --flake .#<hostname>
    
  4. On desktops, install Doom Emacs:

    git clone --depth 1 https://github.com/doomemacs/doomemacs ~/.config/emacs
    ~/.config/emacs/bin/doom install
    ~/.config/emacs/bin/doom sync
    

Rust template #

Scaffolds a project with a pinned toolchain, nightly rustfmt and dev commands:

nix flake init -t git+ssh://git@tangled.org/did:plc:uzur2xk5bcmp54d6vjzrpwfy#rust
nix develop

Type menu in the dev shell to list commands: build, test, lint, fmt, doc and watch. To change the Rust version or enable cross-compilation targets, edit rustVersion and enableCrossTargets in the generated flake.nix.