Declarative macOS development environment using Nix Flakes, nix-darwin, and home-manager.
- Modular architecture: 45+ tool configurations, each with its own
default.nix - Multi-host support: Self-contained personal and work configurations with independent settings
- AI-powered development: Unified configuration for claude-code, opencode, and zed with Sisyphus multi-agent orchestration
- Cross-tool integrations: fzf + bat/eza, git + delta, and more
- Reproducible builds: Everything managed via Nix flakes for complete reproducibility
-
Install Determinate Nix
-
Clone the repo:
git clone https://github.com/mattietea/config ~/.config/nix -
Initial build:
sudo -i nix run nix-darwin -- switch --flake ~/.config/nix
This project uses devenv for development environment management. Enter the devenv shell to access all tools:
devenv shellAvailable scripts (run from within devenv shell or via devenv shell -- <script>):
# Apply changes to nix-darwin
switch
# Format all files (uses treefmt with nixfmt, prettier, yamlfmt)
format
# Lint Nix files (uses statix)
lint
# Update flake inputs
update
# Clean up old Nix generations
clean# Apply changes
sudo darwin-rebuild switch --flake .
# Format code
nix fmt
# Update packages
nix flake update
# Clean up old generations
nix-collect-garbagesudo determinate-nixd upgradeThis project uses devenv to manage the development environment. The devenv.nix file configures:
- Language Server: nixd for Nix language support
- Formatting: treefmt with nixfmt (RFC 0076), prettier, and yamlfmt
- Linting: statix for Nix files, shellcheck for shell scripts
- Git Hooks: Automatic formatting and linting on commit
All formatting uses RFC 0076 style via nixfmt:
- VS Code format-on-save uses nixfmt
treefmtcommand uses nixfmt for Nix files- Git hooks use treefmt (which uses nixfmt)
VS Code is configured to use tools from the devenv environment:
- nix-ide extension uses nixd from devenv
- Formatting uses nixfmt from devenv
- All tools are automatically available when working in this project
The configuration uses a modular architecture following standard nix-darwin and home-manager patterns:
Entry Point (flake.nix):
- Defines flake inputs (nixpkgs, nix-darwin, home-manager)
- Creates host configurations by hostname (e.g.,
Matts-Work-MacBook-Pro) - Passes
inputsdirectly to host configurations
Host Configurations (hosts/personal.nix, hosts/work.nix):
- Each host is a self-contained file defining settings, applications, and packages
- Defines
settingsinline: username, email, environment variables - Calls
lib/mkHost.nixbuilder which handles all darwinSystem boilerplate - Lists applications and packages explicitly — hosts are fully independent
Darwin Modules (modules/darwin/):
- System-level macOS configuration
- macOS system preferences (Dock, Finder, trackpad, keyboard)
- Applied globally to all hosts via module import
- Each module is a folder with a
default.nixfile - Example:
modules/darwin/system/default.nix
Home Manager Modules (modules/home-manager/):
- User-level configuration (dotfiles, user packages, programs)
- Organized into
applications/(GUI apps) andpackages/(CLI tools) - Each module is a folder with a
default.nixfile - Uses home-manager module system
- Imported via
sharedModulesin host configurations (assembled bylib/mkHost.nix) - To add a new tool: create a new folder with
default.nixin the appropriate subdirectory (applications/orpackages/) and add it to each host file that should have it - Folder structure allows for additional files alongside modules (e.g., config files, scripts)
.
├── flake.nix # Flake inputs and outputs
├── devenv.nix # Development environment & scripts
├── lib/
│ └── mkHost.nix # Shared darwinSystem builder function
├── hosts/
│ ├── personal.nix # Self-contained personal config (settings + apps + packages)
│ └── work.nix # Self-contained work config (settings + apps + packages)
└── modules/
├── darwin/system/ # macOS system defaults
└── home-manager/
├── applications/ # GUI apps (brave, zed, discord, etc.)
│ └── */default.nix
└── packages/ # CLI tools (git, fzf, zsh, etc.)
├── mcp/ # Standalone MCP server configuration
└── */default.nix
Key configuration flow:
flake.niximportshosts/personal.nixandhosts/work.nix- Each host defines settings inline and lists its applications and packages
- Hosts call
lib/mkHost.nixwhich handles all darwinSystem boilerplate - Each module configures a tool using home-manager or
home.packages - Cross-tool integrations reference packages via
${pkgs.tool}/bin/tool