Installation Guide
Detailed installation instructions for this Nix configuration on macOS.
Table of Contents
Section titled “Table of Contents”- Overview
- Prerequisites
- Step 1: Install Nix
- Step 2: Install Homebrew
- Step 3: Clone Configuration
- Step 4: Customize for Your System
- Step 5: First-Time Activation
- Step 6: Verify Installation
- Troubleshooting
- Next Steps
Overview
Section titled “Overview”This guide walks you through installing this modular Nix configuration on macOS. The setup includes:
- Nix package manager - Reproducible system configuration
- nix-darwin - macOS system management
- Home Manager - User environment management
- Homebrew - macOS GUI applications
- Hardware security - Optional Ledger wallet integration
- Secrets management - Optional SOPS setup
Estimated time: 15-30 minutes
Prerequisites
Section titled “Prerequisites”System Requirements
Section titled “System Requirements”- OS: macOS 11 (Big Sur) or later
- Architecture: Apple Silicon (M1/M2/M3) or Intel
- Disk Space: 10 GB free space
- Permissions: Administrator access (sudo)
Before You Begin
Section titled “Before You Begin”- Backup important files
- Have Terminal.app ready
- Know your GitHub username (if forking this repo)
- Optional: Ledger Nano S device for hardware security
Step 1: Install Nix
Section titled “Step 1: Install Nix”Choose Your Installer
Section titled “Choose Your Installer”We recommend the Determinate Systems installer for macOS:
curl -fsSL https://install.determinate.systems/nix | sh -s -- install --determinate
Why Determinate Nix?
Section titled “Why Determinate Nix?”✅ Flakes enabled by default ✅ Better macOS integration ✅ No systemd/daemon complexity ✅ Optimized for Apple Silicon ✅ Includes nix-darwin support
Alternative: Official Installer
Section titled “Alternative: Official Installer”If you prefer the official installer:
sh <(curl -L https://nixos.org/nix/install)
Then enable flakes manually:
mkdir -p ~/.config/nixecho "experimental-features = nix-command flakes" >> ~/.config/nix/nix.conf
Verify Nix Installation
Section titled “Verify Nix Installation”# Check Nix versionnix --version
# Should show: nix (Nix) 2.18.x or later
# Test Nix commandnix run nixpkgs#hello
Step 2: Install Homebrew
Section titled “Step 2: Install Homebrew”Homebrew is used for macOS-specific GUI applications (Ledger Live, etc.):
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Add Homebrew to PATH
Section titled “Add Homebrew to PATH”The installer will show instructions. Typically:
# For Apple Siliconeval "$(/opt/homebrew/bin/brew shellenv)"
# For Inteleval "$(/usr/local/bin/brew shellenv)"
Add to your ~/.zshrc
:
# Homebreweval "$(/opt/homebrew/bin/brew shellenv)" # or /usr/local for Intel
Verify Homebrew
Section titled “Verify Homebrew”brew --version# Should show: Homebrew 4.x.x or later
Step 3: Clone Configuration
Section titled “Step 3: Clone Configuration”Option A: Fork This Repository (Recommended)
Section titled “Option A: Fork This Repository (Recommended)”- Fork on GitHub:
https://github.com/original-repo/Config
- Clone your fork:
Terminal window cd ~git clone https://github.com/YOUR-USERNAME/Config.gitcd Config
Option B: Clone Directly
Section titled “Option B: Clone Directly”cd ~git clone https://github.com/original-repo/Config.gitcd Config
Verify Clone
Section titled “Verify Clone”ls -la# Should see: flake.nix, nix/, hosts/, home/, docs/
Step 4: Customize for Your System
Section titled “Step 4: Customize for Your System”Create Your Host Configuration
Section titled “Create Your Host Configuration”-
Copy the example:
Terminal window cp hosts/wikigen-mac.nix hosts/YOUR-HOSTNAME.nix -
Edit your host file:
Terminal window nano hosts/YOUR-HOSTNAME.nix -
Update the configuration:
{ config, pkgs, self, ... }:{# Change to your usernamesystem.primaryUser = "yourusername";users.users.yourusername = {name = "yourusername";home = "/Users/yourusername";};# System-specific packages (optional)environment.systemPackages = with pkgs; [# Add any additional packages here];}
Create Your User Configuration
Section titled “Create Your User Configuration”-
Copy the example:
Terminal window cp home/users/wikigen.nix home/users/YOUR-USERNAME.nix -
Edit your user file:
Terminal window nano home/users/YOUR-USERNAME.nix -
Update git config:
programs.git = {enable = true;userName = "Your Name";userEmail = "your.email@example.com";};
Update flake.nix
Section titled “Update flake.nix”Add your host configuration to flake.nix
:
# In darwinConfigurationsyour-hostname = darwin.lib.darwinSystem { system = "aarch64-darwin"; # or "x86_64-darwin" for Intel modules = [ ./nix/modules/common.nix ./nix/modules/darwin-base.nix ./nix/modules/darwin/homebrew.nix ./nix/profiles/cloud-cli.nix ./nix/profiles/developer.nix # Optional: ./nix/modules/secrets/sops.nix ./hosts/your-hostname.nix
home-manager.darwinModules.home-manager { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; home-manager.users.yourusername = import ./home/users/yourusername.nix; } ]; specialArgs = { inherit self; };};
Step 5: First-Time Activation
Section titled “Step 5: First-Time Activation”Backup Existing Configuration
Section titled “Backup Existing Configuration”# Backup zsh configmv ~/.zshrc ~/.zshrc.backup 2>/dev/null || true
# Backup other configs (optional)cp -r ~/.config ~/.config.backup 2>/dev/null || true
Run First-Time Setup
Section titled “Run First-Time Setup”# First activation requires sudo and nix runsudo nix run nix-darwin -- switch --flake .#your-hostname
This will:
- Build your system configuration
- Install all packages
- Set up shell configuration
- Configure system settings
- Install Homebrew casks
Note: First build may take 10-20 minutes as it downloads all dependencies.
Activate Your Shell
Section titled “Activate Your Shell”# Reload shell to pick up new configexec zsh
Step 6: Verify Installation
Section titled “Step 6: Verify Installation”Check System Configuration
Section titled “Check System Configuration”# View current systemdarwin-rebuild --help
# Check system generationls -l /run/current-system
# View installed packagesdarwin-rebuild list-generations
Test Installed Tools
Section titled “Test Installed Tools”# Nix toolsnix --versiondarwin-rebuild --help
# Cloud CLIsaws --versionkubectl version --clientterraform --version
# Development toolsgit --versionjq --version
# Container tools (requires Colima start)colima versiondocker --version
Verify Homebrew Apps
Section titled “Verify Homebrew Apps”# List installed casksbrew list --cask
# Launch Ledger Live (if installed)open -a "Ledger Live"
Test Nix Commands
Section titled “Test Nix Commands”# Build a packagenix build .#ai-clis
# Enter dev shellnix develop
# Update flakenix flake update
Troubleshooting
Section titled “Troubleshooting”Build Fails with “version mismatch”
Section titled “Build Fails with “version mismatch””Problem: nix-darwin version doesn’t match nixpkgs
Solution:
# Update flake locknix flake update
# Rebuilddarwin-rebuild switch --flake .#your-hostname
“Command not found” after install
Section titled ““Command not found” after install”Problem: Shell hasn’t reloaded new PATH
Solution:
# Reload shellexec zsh
# Or source the profilesource ~/.zshrc
Homebrew not in PATH
Section titled “Homebrew not in PATH”Problem: Homebrew shellenv not configured
Solution:
# Add to ~/.zshrcecho 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zshrc
# Reloadexec zsh
Permission denied errors
Section titled “Permission denied errors”Problem: Missing sudo for first activation
Solution:
# First time MUST use sudosudo nix run nix-darwin -- switch --flake .#your-hostname
# Subsequent builds don't need sudodarwin-rebuild switch --flake .#your-hostname
Build takes forever
Section titled “Build takes forever”Problem: Building from source instead of using binary cache
Solution:
# Check substituters are configurednix show-config | grep substituters
# Should include: https://cache.nixos.org
Flake lock permission issues
Section titled “Flake lock permission issues”Problem: flake.lock owned by root
Solution:
# Fix ownershipsudo chown $USER:staff flake.lock
# Or regeneraterm flake.locknix flake update
Next Steps
Section titled “Next Steps”Essential Configuration
Section titled “Essential Configuration”- First Steps Guide - Learn to customize your setup
- Ledger Setup - Configure hardware wallet
- SOPS Setup - Set up secrets management
Learn the Architecture
Section titled “Learn the Architecture”- Structure Guide - Understand modular organization
- Design Philosophy - Learn architectural decisions
- Nix Fundamentals - Deep dive into Nix
Extend Your Config
Section titled “Extend Your Config”- Adding Packages - Install new software
- Creating Modules - Write custom modules
- Creating Profiles - Build feature bundles
Daily Usage
Section titled “Daily Usage”After installation, update your system with:
# Apply configuration changesdarwin-rebuild switch --flake .#your-hostname
# Update dependenciesnix flake updatedarwin-rebuild switch --flake .#your-hostname
# Garbage collect old generationsnix-collect-garbage --delete-older-than 30d
Get Help
Section titled “Get Help”- Troubleshooting Guide - Common issues
- CLI Commands - Command reference
- NixOS Discourse - Community forum
- GitHub Issues - Report bugs
Installation complete! 🎉
Continue with First Steps to customize your new system.