74 lines
1.6 KiB
Markdown
74 lines
1.6 KiB
Markdown
# Claude-VM
|
|
|
|
Shamelessly stole and refactored from <https://github.com/solomon-b/claude-vm>.
|
|
|
|
A headless QEMU VM with [claude-code](https://github.com/sadjow/claude-code-nix)
|
|
installed. Your current directory is mounted into the VM at `/workspace`.
|
|
|
|
Uses [npins](https://github.com/andir/npins) for dependency pinning and classic Nix (no flakes).
|
|
|
|
## Usage
|
|
|
|
```bash
|
|
nix build -f . claude-vm
|
|
result/bin/claude-vm
|
|
result/bin/claude-vm --dangerously-skip-permissions
|
|
result/bin/claude-vm --model sonnet
|
|
result/bin/claude-vm -p "fix the tests"
|
|
```
|
|
|
|
or
|
|
|
|
```bash
|
|
nix run git+ssh://git@git.obx/oceanbox/claude-vm
|
|
```
|
|
|
|
All arguments are forwarded to claude-code inside the VM.
|
|
|
|
## Home Manager (Npins)
|
|
|
|
To add `claude-vm` as a package in your home-manager configuration using npins:
|
|
|
|
```bash
|
|
# In your home-manager config directory
|
|
npins add git https://git.oceanbox.io/oceanbox/claude-vm -b main
|
|
```
|
|
|
|
Then reference it in your `home.nix`:
|
|
|
|
```nix
|
|
let
|
|
sources = import ./npins;
|
|
inherit (import sources.claude-vm { }) claude-vm;
|
|
in {
|
|
home.packages = [ claude-vm ];
|
|
}
|
|
```
|
|
|
|
## Development Shell
|
|
|
|
```bash
|
|
# First time setup
|
|
direnv allow
|
|
```
|
|
|
|
direnv watches `shell.nix` and rebuilds the environment automatically.
|
|
|
|
## Updating Dependencies
|
|
|
|
```bash
|
|
npins update # update all pins to latest
|
|
npins update nixpkgs # update a single pin
|
|
```
|
|
|
|
## What's Inside
|
|
|
|
- NixOS VM: 4 gigabytes RAM, 4 cores, serial console
|
|
- Packages: `claude-code`, `git`, `curl`, `vim`
|
|
- 9p shared directory: host CWD mounted read-write at `/workspace`
|
|
- Auto-login as `claude` user, claude-code launches automatically
|
|
|
|
## Exit
|
|
|
|
Press `Ctrl-A X` to quit QEMU.
|