Aider Local-First NixOS Dev
Use Aider with local Ollama models (DeepSeek R1 for reasoning, Qwen2.5-Coder for editing) to build NixOS configurations following a constitution-driven architecture, optimized for Intel i3 CPU.
What This Does
Runs Aider in architect mode (high reasoning for planning)Uses local Ollama models: `deepseek-r1:8b` for planning, `qwen2.5-coder:7b` for editingLoads constitutional context files (`.context/constitution.md`, `.context/system-architecture.md`, `flake.nix`) into every sessionTunes map-tokens to 1024 (instead of default 4096) for faster "thinking" on CPU-only Intel i3Auto-commits with author/committer attributionRuns Statix linter and NixOS dry-build on every changeInstructions
1. Prerequisites
Ensure the following are available in the repository:
`.context/constitution.md` — Core design principles and constraints for the codebase`.context/system-architecture.md` — High-level system architecture documentation`flake.nix` — NixOS flake configuration`statix` installed and in PATH (NixOS linter)`nixos-rebuild` command available (NixOS)2. Aider Configuration
Create or update `.aider.conf.yml` in the repository root with:
```yaml
Architecture: High Reasoning for Planning
architect: true
Models: Local-First Strategy
model: ollama/deepseek-r1:8b
editor-model: ollama/qwen2.5-coder:7b
Mental Sandbox: Context Files
read:
- .context/constitution.md
- .context/system-architecture.md
- flake.nix
Performance Tuning for Intel i3 CPU
Reducing this from 4096 to 1024 drastically speeds up
the "thinking" phase on CPU-only setups.
map-tokens: 1024
cache-prompts: true
Thinking Protocol
reasoning-effort: high
check-model-accepts-settings: false
Automated Hygiene
auto-commits: true
attribute-author: true
attribute-committer: true
lint-cmd: "statix check"
test-cmd: "nixos-rebuild dry-build --flake .#nixos-nvme"
```
3. Run Aider
```bash
aider
```
Aider will:
1. Load constitution, architecture docs, and flake.nix into context
2. Use DeepSeek R1 (8B) for reasoning and planning
3. Use Qwen2.5-Coder (7B) for code edits
4. Run Statix linter after changes
5. Run NixOS dry-build to validate configuration
6. Auto-commit changes with proper attribution
4. Workflow
Ask Aider to implement features or refactor code according to the constitutionAider will reason with high effort using DeepSeek R1, then edit with Qwen2.5-CoderOn Intel i3, the reduced `map-tokens: 1024` speeds up reasoning significantlyAll changes are linted and dry-built automatically before commitExample Usage
```bash
Start Aider in the NixOS config repo
cd ~/nix-config
aider
Ask for a change aligned with the constitution
> "Add a new home-manager module for Neovim with LSP support, following the constitution's modularity principle"
Aider will:
1. Read constitution.md to understand modularity constraints
2. Plan the change with DeepSeek R1 (high reasoning)
3. Edit files with Qwen2.5-Coder
4. Run statix check
5. Run nixos-rebuild dry-build
6. Auto-commit with attribution
```
Important Notes
**Local-only**: No API keys required. All inference runs on Ollama.**CPU-optimized**: `map-tokens: 1024` is critical for Intel i3 performance. Increase to 2048 or 4096 if you have more CPU/RAM.**Constitution-driven**: The `.context/constitution.md` file acts as a persistent system prompt. Update it to encode your project's design principles.**NixOS-specific**: The test command assumes a NixOS flake at `.#nixos-nvme`. Adjust the flake output name for your system.**Statix linter**: Catches Nix antipatterns. Install via `nix profile install nixpkgs#statix` or add to your dev shell.Constraints
Requires Ollama running locally with `deepseek-r1:8b` and `qwen2.5-coder:7b` models pulledBest suited for NixOS projects with a flake-based structureCPU-bound: Expect 10-30s reasoning time on Intel i3 (still faster than 4096 map-tokens)Auto-commits require a clean git state (no unstaged changes before Aider runs)