This project provides a sandboxed environment for running Claude Code using Nix and bubblewrap.
** WARNING **: It was not properly security reviewed. It's just a stub. Don't use it outside of a VM.
On NixOS systems, run nix run github:longregen/claude-sandbox
/etc/ssl- SSL certificates for HTTPS/etc/resolv.conf- DNS resolution/nix- Nix store (read-only)
- Current working directory (read-write)
- Development cache directories (if they exist):
.go,.pip,.deno,.pnpm,.yarn,.uv.huggingface,.cached-nix-shell,.nix,.gradle,.zig- Language server caches:
.gopls,.jedi,.lua-language-server, etc.
The sandbox configuration is in default.nix. Key components:
sandboxWrapper: Shell script that sets up the bubblewrap environmentALLOWLIST: Directories and files that are mounted in the sandbox
To see what the sandbox would execute without running it:
DRY_RUN=1 ./result/bin/claude-sandbox --helpTo start a shell in the sandbox environment:
START_SHELL=1 ./result/bin/claude-sandbox
Tip: useful to run with strace to know what's going on.