Welcome! This guide will help you set up your new Mac with this Nix-Darwin configuration.
- macOS 13.0 or later
- Administrative access
- Internet connection
- ~20GB free disk space
- Click "Use this template" button on GitHub
- Name your repository (e.g.,
my-dotfiles) - Clone your new repository:
git clone https://github.com/YOUR-USERNAME/YOUR-REPO-NAME.git cd YOUR-REPO-NAME
- Fork this repository
- Clone your fork:
git clone https://github.com/YOUR-USERNAME/nix-darwin-dotfiles.git cd nix-darwin-dotfiles
This keeps sensitive information out of your repository:
-
Copy the template:
cp .env.example .env
-
Edit the .env file with your personal information:
nano .env
-
Apply the configuration:
./load-env-config.sh
The .env file is automatically ignored by Git, so your sensitive information stays private.
-
Update Git configuration in
modules/home/default.nix:programs.git = { userName = "Your Name"; # <- CHANGE THIS userEmail = "your@email.com"; # <- CHANGE THIS };
-
Update system identifiers in
flake.nix:darwinConfigurations."testhost" = ... # <- Change "testhost" home-manager.users.a = ... # <- Change "a" to your username
-
Review installed apps in
modules/homebrew/apps.nixand comment out any you don't want
Run the safe system detection script to check your setup:
./auto-configure.shThis script will:
- ✅ Detect your system specifications (macOS version, architecture)
- ✅ Check for installed development tools
- ✅ Identify configuration files that still need updates
- ✅ Create a system summary file
- ❌ Will NOT automatically write sensitive information
What it does NOT do (for security):
- ❌ Write Git credentials to files
- ❌ Detect or write SSH/GPG keys
- ❌ Write email addresses or personal information
- ❌ Make automatic changes to configuration files
# Make scripts executable
chmod +x bootstrap-mac.sh
# Run the bootstrap
./bootstrap-mac.shThis will:
- Install Nix package manager
- Apply the configuration
- Install all specified packages
Note: First run takes 15-30 minutes depending on internet speed.
# Run smoke tests
./smoke-test.sh
# Check configuration mode
./test-modern-tools.sh-
Restart your terminal or run:
source ~/.zshrc
-
Optional: Enable modern tool replacements: Edit
modules/home/default.nix:programs.modernTools.enable = true; # Default is false
Then rebuild:
darwin-rebuild switch --flake ".#testhost" -
Set up Git signing (optional):
# Generate GPG key gpg --full-generate-key # Add to Git config git config --global user.signingkey YOUR-KEY-ID
- CLI tools: Add to
modules/system/cli-utils.nix - GUI apps: Add to
modules/homebrew/apps.nix - Development tools: Add to
modules/system/core.nix
Create a new file in modules/:
{ pkgs, ... }:
{
# Your custom configuration
}Then import it in flake.nix.
# Update all packages
nix flake update
darwin-rebuild switch --flake ".#testhost"
# Rollback if something breaks
darwin-rebuild rollback
# Search for packages
nix search nixpkgs package-name
# Clean old generations
nix-collect-garbage -d"command not found: darwin-rebuild"
- Restart your terminal or run:
source /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
"error: flake ... does not exist"
- Make sure you're in the repository directory
- Check that all files are committed:
git add . && git commit -m "Initial setup"
"Homebrew installation failed"
- Homebrew requires Xcode Command Line Tools
- Run:
xcode-select --install
- Check existing issues
- Review the documentation
- Open a new issue with:
- Your macOS version
- Error messages
- Output of
./smoke-test.sh
- Explore the CLI Cheatsheet
- Review Configuration Options
- Star the repository if you find it useful!
- Share your customizations via PR
Happy coding! 🚀