Technical map of the repo so you know what to touch when you adapt it. Also: zero-to-box walkthrough and pointers for running home-manager on your Mac / KVM host.
curl -fsSL https://agentcomputer.ai/install.sh | bash
brew install just gum jq fzf gh # or your package manager
brew install bitwarden-cli # optional, only if you use bw for secrets
gh auth login
computer login
gh repo create my-computer-nix --template AgentComputerAI/computer-nix --public --clone
cd my-computer-nix
cp .env.example .env
Edit .env:
FLAKE_REF=github:<you>/my-computer-nix#computer
COMPUTER_SIZE=ram-4g
Commit and push — FLAKE_REF must resolve over the network:
git add . && git commit -m "init" && git push
just create mybox
just go mybox
computer ssh mybox --tmux
just go runs the full flow, idempotently per-box:
- switch — installs Nix (Determinate installer) if missing, starts
nix-daemon, runshome-manager switch --flake $FLAKE_REF. Cheap on re-run. - auth — pipes your laptop's
gh auth tokenover stdin intogh auth login --with-tokenon the box, thengh auth setup-git. Skipped if already done. - secrets — if
./secrets.jsonis missing, launches agumfuzzy multi-select picker that discovers candidates from Bitwarden, env vars, and well-known config files.secrets-apply.shthen resolves every entry and pushes~/.config/secrets/shell.zsh(mode 0600) to the box. Skipped if already done. - agent creds —
computer claude-login+computer codex-login. Skipped if already done. - repos — always launches the
gumfuzzy picker overgh repo list. Previously-picked repos are pre-selected. Clones into the configured root.
Idempotency markers live at ~/.cache/computer-nix/*.done on the box. Redo everything with just go mybox force.
Edit any home/*.nix, push to your fork, just switch mybox. The box fetches the new flake and reapplies.
For iteration without pushing:
computer sync ./ --computer mybox
computer ssh mybox -- 'nix run nixpkgs#home-manager -- switch \
--flake path:/home/node/computer-nix#computer -b backup --no-write-lock-file'
.
├── flake.nix flake inputs + homeConfigurations.computer
├── home/ home-manager modules (programs.*, xdg, activation)
│ └── default.nix imports every sibling module
├── skills.nix declarative agent-skills manifest
├── justfile user-facing commands; `just go` is the entrypoint
└── scripts/ bash implementing each justfile recipe
| change | file |
|---|---|
| flake target | .env → FLAKE_REF=github:<you>/my-computer-nix#computer |
| default box size | .env → COMPUTER_SIZE |
| which tools are on the box | home/packages.nix |
| shell aliases | home/aliases.nix |
| prompt colors | home/prompt.nix (zstyle blocks at the top) |
| your neovim / dotfiles | flake.nix → inputs.nvim-config.url |
| agent skills installed | skills.nix at repo root |
| default clone root | repos.example.json → "root" |
flake.nix
├── inputs.nixpkgs
├── inputs.home-manager
└── inputs.nvim-config (your dotfiles; flake = false)
│
▼
homeConfigurations.computer
= home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux;
modules = [ ./home/default.nix ];
}
home/default.nix
imports every home/*.nix module. Adding a new module
= create home/foo.nix + add `./foo.nix` to the imports list.
just go <handle>
└── scripts/pick-handle.sh ← pick once, use everywhere
│
▼
scripts/bootstrap.sh ← nix install + home-manager switch
│
▼ (skip if ~/.cache/computer-nix/auth.done)
scripts/auth-apply.sh ← gh auth on box
│
▼ (skip if ~/.cache/computer-nix/secrets.done)
scripts/secrets-init.sh ← only if no ./secrets.json yet
scripts/secrets-apply.sh ← push secrets shell.zsh (0600)
│
▼ (skip if ~/.cache/computer-nix/agent.done)
computer claude-login / codex-login
│
▼ (always)
scripts/repos-init.sh ← fuzzy picker (pre-selects last deploy)
scripts/repos-apply.sh ← clone or fast-forward each repo
Markers on the box live in ~/.cache/computer-nix/*.done. Wipe them with just go <handle> force or computer ssh <handle> -- rm -rf ~/.cache/computer-nix.
# flake.nix
inputs.nvim-config = {
url = "github:<you>/<your-dotfiles>";
flake = false;
};home/nvim.nix reads ${inputs.nvim-config}/config/nvim (adjust the path if your dotfiles layout differs). Run nix flake update nvim-config to repin.
- Create
home/<tool>.nixas a flat attrset — no header comment, match existing style. - Add
./<tool>.nixto the imports list inhome/default.nix. just switch <box>to apply.
- Write
scripts/<step>-apply.shtaking<handle>as$1. - Add a recipe to the justfile that calls it via
pick-handle.sh. - If it's expensive and one-shot, wire it into
just gobehind a marker check (done_on_box <step>/mark_done <step>). If it's per-task (like repos), call it unconditionally.
This repo is scoped to x86_64-linux boxes. If you want the same tools + dotfiles on your Mac or a local KVM VM, see harivansh-afk/nix — it shares the same home-manager modules and nvim config across:
- macOS (darwin) via
nix-darwin+home-manager - Linux (KVM / bare metal) via NixOS +
home-manager
The general pattern: point both repos at the same nvim-config flake input, and share home/*.nix modules by importing them from a common place (or vendoring them). Platform-specific bits (programs.foo that only exists on Linux) live behind lib.mkIf pkgs.stdenv.isLinux.