🚀 Quick Setup Guide
🚀 Quick Setup Guide
Welcome! This guide will help you set up your new Mac with this Nix-Darwin configuration.
Prerequisites
- macOS 13.0 or later
- Administrative access
- Internet connection
- ~20GB free disk space
Step-by-Step Setup
1. Fork/Clone This Repository
Option A: Using as a Template (Recommended)
- 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
Option B: Direct Fork
- Fork this repository
- Clone your fork:
git clone https://github.com/YOUR-USERNAME/nix-darwin-dotfiles.git cd nix-darwin-dotfiles
2. 🔒 Required: Configuration (Security First)
⚠️ IMPORTANT: For security, you must configure personal details before proceeding.
Option A: Environment File (Recommended)
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.
Option B: Manual Configuration
- 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.nix
and comment out any you don’t want
3. System Detection (Optional)
Run the safe system detection script to check your setup:
./auto-configure.sh
This 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
4. Run the Bootstrap
# Make scripts executable
chmod +x bootstrap-mac.sh
# Run the bootstrap
./bootstrap-mac.sh
This will:
- Install Nix package manager
- Apply the configuration
- Install all specified packages
Note: First run takes 15-30 minutes depending on internet speed.
4. Verify Installation
# Run smoke tests
./smoke-test.sh
# Check configuration mode
./test-modern-tools.sh
5. Post-Installation
- 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
🎯 Customization Tips
Adding Your Own Tools
- 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
Creating Custom Modules
Create a new file in modules/
:
{ pkgs, ... }:
{
# Your custom configuration
}
Then import it in flake.nix
.
Useful Commands
# 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
🆘 Troubleshooting
Common Issues
“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
Getting Help
- Check existing issues
- Review the documentation
- Open a new issue with:
- Your macOS version
- Error messages
- Output of
./smoke-test.sh
🎉 Next Steps
- Explore the CLI Cheatsheet
- Review Configuration Options
- Star the repository if you find it useful!
- Share your customizations via PR
Happy coding! 🚀