Skip to content

darkmatter/nixmac

Repository files navigation

icon

nixmac

An AI-powered macOS configuration manager built on nix-darwin.
Describe what you want in plain English. nixmac evolves your Nix config, builds it, and applies it.

Latest Release License


What is nixmac?

nixmac is a native macOS app (Tauri + Rust) that puts an AI agent in front of your nix-darwin configuration. Instead of hand-editing .nix files, you chat with nixmac:

"Install Tailscale and make it start at login"

The agent reads your config, plans the changes, edits the Nix files, builds the system, and applies it — all while you watch. If something breaks, roll back in one click.

Key Features

  • Natural-language config evolution — an agentic loop with tool use (read, edit, search) that iterates until your system matches the prompt
  • Multi-provider AI — OpenAI/OpenRouter (default), Ollama for fully local operation
  • Tool-augmented agentread_file, write_file, search_packages, search_docs, search_code tools give the model deep context about nix-darwin options and nixpkgs
  • Chat memory — session context persists across turns for multi-step conversations
  • Smart summarization — every changeset and commit gets an AI-generated summary with token-budgeted batching
  • Git-native history — every evolution creates a branch, every apply is a commit; full diff-based change tracking
  • One-click rollback — revert to any previous system generation
  • Secret scanning — detects accidentally committed API keys and credentials
  • Sentry integration — opt-in crash reporting with automatic PII scrubbing
  • CLI + GUI — use the menu bar app or nixmac evolve "..." from the terminal
  • Eval suite — reproducible benchmarks for measuring agent accuracy across models

Architecture

nixmac/
├── apps/
│   ├── native/        # Tauri + Rust desktop app (core agent, tools, git, nix)
│   ├── web/           # React + TanStack Router frontend (dashboard, onboarding)
│   ├── server/        # Hono + tRPC API server
│   ├── fumadocs/      # Documentation site (Next.js / Fumadocs)
│   └── eval/          # Python eval harness for model benchmarking
├── packages/
│   ├── api/           # Shared business logic
│   ├── auth/          # Better-Auth configuration
│   ├── db/            # Drizzle ORM + PostgreSQL schema
│   ├── ui/            # Shared UI components
│   ├── config/        # Shared config utilities
│   ├── env/           # Environment variable validation
│   ├── hono-api/      # Hono middleware and API helpers
│   └── znv/           # Zod + env parsing

The Evolution Loop

  1. User prompt → agent receives the request
  2. Tool use → agent reads config files, searches nix-darwin docs, searches nixpkgs
  3. Edit → agent writes changes via semantic file edits
  4. Builddarwin-rebuild build validates the configuration
  5. Iterate → if the build fails, agent reads errors and tries again (up to N iterations)
  6. Applydarwin-rebuild switch activates the new system generation
  7. Summarize → changeset and commit get AI-generated descriptions

Getting Started

Prerequisites

Install from Release

Download the latest .dmg from Releases, open it, and drag nixmac.app into your Applications folder before launching it. Running nixmac directly from the DMG triggers macOS App Translocation, which prevents Full Disk Access from being granted.

Build from Source

git clone https://github.com/darkmatter/nixmac.git
cd nixmac
devenv shell
bun install
cd apps/native && bun run tauri build --bundles app

Development

devenv shell
bun install

# Start everything (web + server + native app in dev mode)
devenv up

# Or start individual pieces
bun run dev:web        # React frontend at http://localhost:3001
bun run dev:server     # API server at http://localhost:3000
bun run dev:native     # Tauri desktop app

Setting Up nix-darwin

If you don't already have a nix-darwin configuration:

mkdir -p ~/.darwin && cd ~/.darwin
git init

Copy one of the included templates:

Template Description
nix-darwin-determinate Minimal nix-darwin for Determinate Nix
nixos-unified Cross-platform (macOS + NixOS)
minimal Bare-bones starting point

Then activate:

sudo cp /etc/{bashrc,zshrc,zshenv} /etc/{bashrc,zshrc,zshenv}.before-nix-darwin
sudo -i nix run nix-darwin/master#darwin-rebuild -- switch --flake ~/.darwin#$HOSTNAME

Determinate Nix note: darwin-rebuild isn't installed globally. Run it via sudo -i nix run nix-darwin/master#darwin-rebuild.

AI Configuration

nixmac uses separate models for evolution (config changes via tool use) and summarization (commit messages, UI labels).

Variable Default Description
EVOLVE_PROVIDER openai openai, openrouter, or ollama
EVOLVE_MODEL anthropic/claude-sonnet-4 Model for config evolution
SUMMARY_AI_PROVIDER openai Provider for summarization
SUMMARY_MODEL openai/gpt-4o-mini Model for summaries
OLLAMA_API_BASE http://localhost:11434 Ollama endpoint

For fully local operation: EVOLVE_PROVIDER=ollama SUMMARY_AI_PROVIDER=ollama devenv up

Note: Models under ~70B parameters tend to struggle with the multi-tool evolution workflow.

CLI

# Basic evolution
nixmac evolve "install ripgrep and fd"

# With options
nixmac evolve "enable Touch ID for sudo" \
  --config ~/.darwin \
  --max-iterations 10 \
  --evolve-provider ollama \
  --evolve-model qwen3-coder:30b

# Dump results to JSON
nixmac evolve "add Homebrew casks for Firefox and 1Password" --out result.json

Eval Suite

The apps/eval/ directory contains a reproducible benchmark harness for measuring evolution accuracy across models and providers, including support for vLLM and Ollama backends.

cd apps/eval
uv sync
python run_evals.py --provider ollama --model qwen3-coder:30b
python calc_stats.py

Deployment

The web app deploys via Alchemy:

cd apps/web && bun run deploy    # deploy
cd apps/web && bun run destroy   # tear down

Releases

Tagged commits trigger CI to produce signed .dmg builds:

npx release-it   # interactive version bump + tag + GitHub release

Database

nixmac uses PostgreSQL with Drizzle ORM for the web app and server:

bun run db:push      # apply schema
bun run db:studio    # open Drizzle Studio
bun run db:generate  # generate migrations

Logs

  • darwin-rebuild logs: ~/Library/Logs/nixmac/
  • App logs: stdout/stderr (or set NIXMAC_LOGFILE for file output)
  • Provider completion logs: set NIXMAC_RECORD_COMPLETIONS for full provider completions
# Merged tail of everything
tail -F ${NIXMAC_LOGFILE} ~/Library/Logs/nixmac/*

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors