Skip to content

Installation Guide

Detailed installation instructions for this Nix configuration on macOS.



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


  • 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)
  • Backup important files
  • Have Terminal.app ready
  • Know your GitHub username (if forking this repo)
  • Optional: Ledger Nano S device for hardware security

We recommend the Determinate Systems installer for macOS:

Terminal window
curl -fsSL https://install.determinate.systems/nix | sh -s -- install --determinate

✅ Flakes enabled by default ✅ Better macOS integration ✅ No systemd/daemon complexity ✅ Optimized for Apple Silicon ✅ Includes nix-darwin support

If you prefer the official installer:

Terminal window
sh <(curl -L https://nixos.org/nix/install)

Then enable flakes manually:

Terminal window
mkdir -p ~/.config/nix
echo "experimental-features = nix-command flakes" >> ~/.config/nix/nix.conf
Terminal window
# Check Nix version
nix --version
# Should show: nix (Nix) 2.18.x or later
# Test Nix command
nix run nixpkgs#hello

Homebrew is used for macOS-specific GUI applications (Ledger Live, etc.):

Terminal window
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

The installer will show instructions. Typically:

Terminal window
# For Apple Silicon
eval "$(/opt/homebrew/bin/brew shellenv)"
# For Intel
eval "$(/usr/local/bin/brew shellenv)"

Add to your ~/.zshrc:

Terminal window
# Homebrew
eval "$(/opt/homebrew/bin/brew shellenv)" # or /usr/local for Intel
Terminal window
brew --version
# Should show: Homebrew 4.x.x or later

Section titled “Option A: Fork This Repository (Recommended)”
  1. Fork on GitHub: https://github.com/original-repo/Config
  2. Clone your fork:
    Terminal window
    cd ~
    git clone https://github.com/YOUR-USERNAME/Config.git
    cd Config
Terminal window
cd ~
git clone https://github.com/original-repo/Config.git
cd Config
Terminal window
ls -la
# Should see: flake.nix, nix/, hosts/, home/, docs/

  1. Copy the example:

    Terminal window
    cp hosts/wikigen-mac.nix hosts/YOUR-HOSTNAME.nix
  2. Edit your host file:

    Terminal window
    nano hosts/YOUR-HOSTNAME.nix
  3. Update the configuration:

    { config, pkgs, self, ... }:
    {
    # Change to your username
    system.primaryUser = "yourusername";
    users.users.yourusername = {
    name = "yourusername";
    home = "/Users/yourusername";
    };
    # System-specific packages (optional)
    environment.systemPackages = with pkgs; [
    # Add any additional packages here
    ];
    }
  1. Copy the example:

    Terminal window
    cp home/users/wikigen.nix home/users/YOUR-USERNAME.nix
  2. Edit your user file:

    Terminal window
    nano home/users/YOUR-USERNAME.nix
  3. Update git config:

    programs.git = {
    enable = true;
    userName = "Your Name";
    userEmail = "your.email@example.com";
    };

Add your host configuration to flake.nix:

# In darwinConfigurations
your-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; };
};

Terminal window
# Backup zsh config
mv ~/.zshrc ~/.zshrc.backup 2>/dev/null || true
# Backup other configs (optional)
cp -r ~/.config ~/.config.backup 2>/dev/null || true
Terminal window
# First activation requires sudo and nix run
sudo nix run nix-darwin -- switch --flake .#your-hostname

This will:

  1. Build your system configuration
  2. Install all packages
  3. Set up shell configuration
  4. Configure system settings
  5. Install Homebrew casks

Note: First build may take 10-20 minutes as it downloads all dependencies.

Terminal window
# Reload shell to pick up new config
exec zsh

Terminal window
# View current system
darwin-rebuild --help
# Check system generation
ls -l /run/current-system
# View installed packages
darwin-rebuild list-generations
Terminal window
# Nix tools
nix --version
darwin-rebuild --help
# Cloud CLIs
aws --version
kubectl version --client
terraform --version
# Development tools
git --version
jq --version
# Container tools (requires Colima start)
colima version
docker --version
Terminal window
# List installed casks
brew list --cask
# Launch Ledger Live (if installed)
open -a "Ledger Live"
Terminal window
# Build a package
nix build .#ai-clis
# Enter dev shell
nix develop
# Update flake
nix flake update

Problem: nix-darwin version doesn’t match nixpkgs

Solution:

Terminal window
# Update flake lock
nix flake update
# Rebuild
darwin-rebuild switch --flake .#your-hostname

Problem: Shell hasn’t reloaded new PATH

Solution:

Terminal window
# Reload shell
exec zsh
# Or source the profile
source ~/.zshrc

Problem: Homebrew shellenv not configured

Solution:

Terminal window
# Add to ~/.zshrc
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zshrc
# Reload
exec zsh

Problem: Missing sudo for first activation

Solution:

Terminal window
# First time MUST use sudo
sudo nix run nix-darwin -- switch --flake .#your-hostname
# Subsequent builds don't need sudo
darwin-rebuild switch --flake .#your-hostname

Problem: Building from source instead of using binary cache

Solution:

Terminal window
# Check substituters are configured
nix show-config | grep substituters
# Should include: https://cache.nixos.org

Problem: flake.lock owned by root

Solution:

Terminal window
# Fix ownership
sudo chown $USER:staff flake.lock
# Or regenerate
rm flake.lock
nix flake update

  1. First Steps Guide - Learn to customize your setup
  2. Ledger Setup - Configure hardware wallet
  3. SOPS Setup - Set up secrets management
  1. Structure Guide - Understand modular organization
  2. Design Philosophy - Learn architectural decisions
  3. Nix Fundamentals - Deep dive into Nix
  1. Adding Packages - Install new software
  2. Creating Modules - Write custom modules
  3. Creating Profiles - Build feature bundles

After installation, update your system with:

Terminal window
# Apply configuration changes
darwin-rebuild switch --flake .#your-hostname
# Update dependencies
nix flake update
darwin-rebuild switch --flake .#your-hostname
# Garbage collect old generations
nix-collect-garbage --delete-older-than 30d


Installation complete! 🎉

Continue with First Steps to customize your new system.