Exploring the integration between Nix and AI coding agents. This repository serves as a testbed for packaging, sandboxing, and enhancing AI-powered development tools within the Nix ecosystem.
As Nix and DevOps consultants, this work is part of our strategic exploration—we are evaluating how LLMs and coding agents will transform our consulting practice and the solutions we deliver to clients. Through these experiments, we aim to:
- Stay ahead of the curve: Understand how AI agents will reshape infrastructure-as-code and DevOps practices
- Enhance our consulting toolkit: Develop AI-augmented workflows that deliver better results for clients faster
- Build expertise: Position ourselves as leaders in AI-enhanced Nix and DevOps consulting
- Create client value: Discover how AI agents can solve complex infrastructure challenges more effectively
- Develop best practices: Establish patterns for secure, reproducible AI integration in enterprise environments
This project explores several key integration patterns between Nix and AI agents:
- Declarative packaging: All AI tools are packaged as Nix derivations, ensuring reproducible builds across different systems
- Version pinning: Exact versions are locked via flake.lock for consistent behavior
- Cross-platform support: Native support for Linux and macOS on both x86_64 and aarch64
- claudebox: Demonstrates running AI agents in bubblewrap sandboxes with restricted filesystem access
- Transparency: All AI agent actions are logged and displayed in real-time via tmux integration
- Controlled access: Read-only system access with write permissions limited to project directories
- claude-code-router: Shows how to decouple AI interfaces from specific providers
- Alternative backends: Route requests to different LLM providers while maintaining the same interface
- Extensibility: Easy addition of new AI tools through modular package structure
- Unified tooling: AI agents work seamlessly within Nix development shells
- Format integration: AI-generated code automatically follows project formatting rules
- Dependency management: AI tools have access to all project dependencies through Nix
This repository uses GitHub Actions to automatically update all packages and flake inputs daily. Updates are created as individual pull requests for easy review and testing. See .github/workflows/update.yml
for the workflow configuration.
> ./scripts/generate-package-docs.sh
- Description: Backlog.md - A tool for managing project collaboration between humans and AI Agents in a git ecosystem
- Version: 1.6.3
- License: MIT
- Homepage: https://github.com/MrLesk/Backlog.md
- Usage:
nix run .#backlog-md -- --help
- Description: Sandboxed environment for Claude Code
- Version: unknown
- License: Check package
- Usage:
nix run .#claudebox -- --help
- Description: Agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster
- Version: 1.0.62
- License: unfree
- Homepage: https://github.com/anthropics/claude-code
- Usage:
nix run .#claude-code -- --help
- Description: Use Claude Code without an Anthropics account and route it to another LLM provider
- Version: 1.0.28
- License: MIT
- Homepage: https://github.com/musistudio/claude-code-router
- Usage:
nix run .#claude-code-router -- --help
- Description: one CLI to format the code tree
- Version: unknown
- License: MIT
- Homepage: https://github.com/numtide/treefmt
- Usage:
nix run .#formatter -- --help
- Description: AI agent that brings the power of Gemini directly into your terminal
- Version: 0.1.14
- License: Apache-2.0
- Homepage: https://github.com/google-gemini/gemini-cli
- Usage:
nix run .#gemini-cli -- --help
- Description: AI coding agent, built for the terminal
- Version: 0.3.80
- License: MIT
- Homepage: https://github.com/sst/opencode
- Usage:
nix run .#opencode -- --help
- Description: Command-line AI workflow tool for Qwen3-Coder models
- Version: 0.0.1-alpha.10
- License: Apache-2.0
- Homepage: https://github.com/QwenLM/qwen-code
- Usage:
nix run .#qwen-code -- --help
Add to your system configuration:
{
inputs = {
nix-ai-tools.url = "github:numtide/nix-ai-tools";
};
# In your system packages:
environment.systemPackages = with inputs.nix-ai-tools.packages.${pkgs.system}; [
claude-code
opencode
gemini-cli
qwen-code
# ... other tools
];
}
# Try Claude Code
nix run github:numtide/nix-ai-tools#claude-code
# Try OpenCode
nix run github:numtide/nix-ai-tools#opencode
# Try Gemini CLI
nix run github:numtide/nix-ai-tools#gemini-cli
# Try Qwen Code
nix run github:numtide/nix-ai-tools#qwen-code
nix develop
# Build a specific package
nix build .#claude-code
# Build all packages
nix build .#packages.x86_64-linux.claude-code
nix build .#packages.x86_64-linux.opencode
nix build .#packages.x86_64-linux.qwen-code
# etc...
# Format all code
nix fmt
# Run checks
nix flake check
All packages support:
x86_64-linux
aarch64-linux
x86_64-darwin
aarch64-darwin
Most packages are based on Node.js 20, with some providing pre-built binaries. Each package is self-contained with all required dependencies.
This repository serves as a laboratory for exploring how Nix can enhance AI-powered development:
- Sandboxed execution: claudebox demonstrates transparent, sandboxed AI agent execution
- Provider abstraction: claude-code-router explores decoupling AI interfaces from specific providers
- Tool composition: Investigating how multiple AI agents can work together in Nix environments
- Automatic devshell reloading: Enable AI agents to detect and reload their development shells whenever the Nix configuration changes
- Live environment updates: Seamless integration of new tools and dependencies without interrupting AI agent sessions
- State preservation: Maintain AI agent context across devshell reloads
- Nixpkgs program indexing: Make the entire nixpkgs collection queryable by AI agents for dynamic tool discovery
- Smart tool suggestions: AI agents can recommend and instantly access appropriate tools from nixpkgs based on task requirements
- On-demand tool loading: Just-in-time provisioning of development tools without pre-declaring all dependencies
- Git worktree integration: Enable AI agents to dynamically create and manage git worktrees for parallel development branches
- Isolated experiment spaces: Each AI task can operate in its own worktree without affecting the main development flow
- Automatic context switching: AI agents can seamlessly move between different worktrees based on task requirements
- Online work sessions: Support for long-running, asynchronous AI agent sessions that persist beyond terminal sessions
- Background task execution: AI agents can continue working on tasks while developers focus on other activities
- Progress synchronization: Real-time updates and notifications for ongoing AI agent work
- Session handoff: Ability to pause, resume, and transfer AI agent sessions between different environments
- Deterministic AI outputs: Using Nix's reproducibility features to create more predictable AI behaviors
- Context management: Leveraging Nix's declarative nature to manage AI agent contexts and memory
- Multi-agent orchestration: Coordinating multiple AI tools through Nix expressions
- Audit trails: Complete provenance tracking of AI-generated code through Nix derivations
- How can AI agents dynamically adapt to changing Nix environments without losing context?
- What's the best way to expose the entire nixpkgs ecosystem to AI agents for tool discovery?
- Can git worktrees provide effective isolation for parallel AI agent experiments?
- How do we build robust asynchronous AI workflows that survive disconnections and environment changes?
- What abstractions are needed to make Nix environments truly AI-native?
- How can we balance AI agent autonomy with security and reproducibility guarantees?
- How will AI agents transform Nix and DevOps consulting engagements?
- What new service offerings can we create by combining Nix expertise with AI capabilities?
- How do we help clients adopt AI-enhanced DevOps practices safely and effectively?
- Which infrastructure challenges become trivial with AI assistance vs requiring human expertise?
- How can we use AI to accelerate Nix adoption and reduce the learning curve for clients?
- What governance and compliance frameworks are needed for AI-assisted infrastructure management?
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Run
nix fmt
before committing - Submit a pull request
Individual tools are licensed under their respective licenses:
- claude-code: Proprietary
- opencode: MIT
- gemini-cli: Apache 2.0
- claude-code-router: Check package
- claudebox: Check package
The Nix packaging code in this repository is licensed under MIT.