nix-ai — Stack de IA Declarativo
dryvist/nix-ai
Stack de IA declarativo em Nix, portável entre máquinas
Ver no GitHubToolkit de IA reproduzível declarado em Nix, gerenciando Claude, Gemini, Copilot e 15+ servidores MCP em um único flake. Sincroniza toda sua configuração entre máquinas com um comando, eliminando reconfiguração manual.
Instalação
npx convez-ai dryvist/nix-ai1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.
Métricas
Casos de uso
- Sincronizar configuração de múltiplas ferramentas IA entre máquinas de desenvolvimento
- Gerenciar plugins, permissões e MCP servers como código versionado
- Executar inferência local em Apple Silicon com MLX via Nix
Veredito

Solução elegante para quem trabalha com Nix e precisa de portabilidade total do stack de IA. Curva de aprendizado steep se você não domina Nix/home-manager, mas oferece reprodutibilidade genuína que ferramentas de configuração UI não alcançam.
README
A tradução para o português deste README ainda está na fila.
nix-ai
Your AI coding toolkit, declared once. Reproduced everywhere
Ever spent hours configuring Claude Code plugins, Gemini settings, and MCP servers -- only to lose it all when you switch machines? nix-ai captures your entire AI setup as code using Nix. One command rebuilds everything, identically, every time.
What it manages
| Tool | What you get |
|---|---|
| Claude Code | Plugin ecosystem, hooks, agents, commands, rules, statusline |
| Gemini CLI | Settings, custom commands, permission rules |
| GitHub Copilot | Configuration, permissions |
| OpenAI Codex | Settings |
| MCP Servers | 15+ servers — GitHub, Terraform, Context7, PAL, filesystem, memory, and more |
| Plugin Marketplace | Curated marketplaces with Nix-pinned flake inputs |
| AI Dev Tools | cclint, doppler-mcp, claude-flow, sync-mlx-models |
| MLX | Local Apple Silicon inference via vllm-mlx with macOS launchd integration |
Prerequisites
- Nix (Determinate Nix recommended)
- home-manager
- Compatible platform:
aarch64-darwinorx86_64-linux
Quick start
Add to your Nix flake:
{
inputs.nix-ai = {
url = "github:JacobPEvans/nix-ai";
inputs.nixpkgs.follows = "nixpkgs";
inputs.home-manager.follows = "home-manager";
};
}
Then in your home-manager config:
sharedModules = [ nix-ai.homeManagerModules.default ];
That's it. Every AI tool, every plugin, every permission rule — managed by Nix.
How it works
nix-ai exports home-manager modules that merge into your existing configuration:
| Export | What it includes |
|---|---|
homeManagerModules.default | Full AI stack — Claude, Gemini, Copilot, Codex, MCP, MLX, dev tools |
homeManagerModules.claude | Just Claude Code |
homeManagerModules.codex | Just OpenAI Codex |
homeManagerModules.maestro | Just Maestro orchestration |
lib.ci.claudeSettingsJson | Pure JSON for CI validation (no derivations needed) |
lib.ci.codexRules | Codex rules export for CI validation and downstream consumers |
lib.aiStackModels | Role-name → physical model ID registry builder — a function { defaultLocalModelId } (no module system needed) |
Cross-repo consumption — lib.aiStackModels
lib.aiStackModels is a function { defaultLocalModelId } (no home-manager module system
required) that maps every stable capability-class name to the supplied physical
mlx-community/* model ID. The caller provides defaultLocalModelId (sourced from the
AI_MODEL_LOCAL_LLM org variable / Doppler secret — never hardcoded in this repo). Foreign
consumers such as the orbstack-kubernetes Bifrost gateway can call it directly so
model: "default" resolves prefix-free without duplicating the registry.
inputs.nix-ai.url = "github:JacobPEvans/nix-ai";
# ...
# Build Bifrost alias table from role names to mlx-local/ prefixed physical IDs
aliases = lib.mapAttrs
(_role: physical: "mlx-local/${physical}")
(inputs.nix-ai.lib.aiStackModels { defaultLocalModelId = "mlx-community/<provider-tag>-<model-name>-<quant>"; });
The module option services.aiStack.models remains the public API for nix-ai home-manager
consumers; lib.aiStackModels is for foreign consumers that do not import the module.
Self-contained design
The module injects its own dependencies via _module.args. Your consuming flake only needs two lines:
inputs.nixpkgs.follows = "nixpkgs";
inputs.home-manager.follows = "home-manager";
No AI-specific inputs to wire up. No extra configuration. It just works.
Available module options
Key enable toggles exposed by the default module:
| Option | Type | Default | Description |
|---|---|---|---|
programs.claude.enable | bool | — | Enable Claude Code configuration |
programs.claude.apiKeyHelper.enable | bool | false | Headless API key authentication via Bitwarden |
programs.claudeStatusline.enable | bool | false | Claude Code powerline statusline |
programs.claude.settings.sandbox.enabled | bool | false | Filesystem/network sandbox isolation |
programs.claude.settings.alwaysThinkingEnabled | bool | true | Extended thinking mode |
programs.claude.remoteControlAtStartup | bool or null | null | Remote Control auto-start |
programs.claude.model | string or null | null | Override default model (e.g. "opus", "sonnet") |
programs.claude.effortLevel | enum or null | null | Adaptive reasoning effort ("low", "medium", "high"); null = upstream default (medium for Max/Team as of v2.1.68) |
programs.claude.trustedProjectDirs | list of str | [] | Base directories for auto-trust of CLAUDE.md imports |
For the full option set, see modules/claude/options.nix.
Testing and validation
Run quality checks locally:
nix flake check
This runs formatting (nixfmt), static analysis (statix), dead code detection (deadnix), shell script linting (shellcheck), and full module evaluation (module-eval) to verify the home-manager module instantiates correctly with real inputs.
Fix formatting automatically:
nix fmt
Repository structure
modules/
├── claude/ # Claude Code module — see [modules/claude/README.md](modules/claude/README.md)
├── maestro/ # Maestro agent orchestration
├── mcp/ # 15+ MCP server definitions
├── common/ # Shared permission engine
├── gh-extensions/ # GitHub CLI extensions (gh-aw)
├── permissions/ # Per-tool permission rules
├── mlx/ # MLX inference server (vllm-mlx)
├── ai-tools.nix # AI development tool packages
├── gemini.nix # Gemini CLI configuration
├── copilot.nix # GitHub Copilot configuration
└── codex.nix # OpenAI Codex configuration
lib/ # Key lib files (not full listing)
├── claude-settings.nix # Pure settings generator
└── claude-registry.nix # Marketplace format functions
Part of a trio
This repo is one of three that work together:
| Repo | What it does |
|---|---|
| nix-ai (you are here) | AI coding tools |
| nix-home | Dev environment (git, zsh, VS Code, tmux) |
| nix-darwin | macOS system config (consumes both) |
License
MIT