This guide helps you migrate from the old Homebrew/symlink-based dotfiles to the new Nix-based configuration.
The new dotfiles setup uses:
- Nix Darwin for system-level macOS configuration
- Home Manager for user packages and dotfiles
- Nix Flakes for reproducible, declarative configuration
- brew-nix for GUI applications that aren't available in nixpkgs
- Backup your current configuration (the migration script does this automatically)
- Note any custom Fish functions or aliases
- Export your Homebrew package list
- Save any custom configurations (git, vim, etc.)
Run the analysis script to understand your current setup:
./analyze-migration.fishThis will show:
- Installed package managers
- Current shell configuration
- Existing dotfiles
- Potential conflicts
Execute the migration script to backup your configuration:
./migrate-to-nix.shThis will:
- Create a timestamped backup of all configurations
- Remove old symlinks
- Generate a migration report
- Provide next steps
If you don't have Nix installed:
# Official Nix installer
curl -L https://nixos.org/nix/install | shClone the new dotfiles and bootstrap your system:
# Clone the repository
git clone https://github.com/srizzling/.dotfiles.fish ~/.dotfiles
cd ~/.dotfiles
# For personal machines
make bootstrap-personal
# For work machines
make bootstrap-workThe new setup manages Fish differently:
Old way (Fisher):
fisher install jorgebucaran/autopair.fish
fisher install franciscolourenco/doneNew way (Home Manager):
All plugins are declared in home-manager/shell.nix:
programs.fish = {
plugins = [
{
name = "autopair";
src = pkgs.fetchFromGitHub { ... };
}
];
};-
Check your backup for custom functions:
ls ~/.dotfiles-backup-*/config/fish/functions/
-
Add them to the new configuration:
- Simple aliases: Add to
shellAliasesinhome-manager/shell.nix - Complex functions: Add to
functionsinhome-manager/shell.nix
- Simple aliases: Add to
Example:
programs.fish = {
shellAliases = {
ll = "lsd -la";
gs = "git status";
};
functions = {
gitclean = ''
git branch --merged | grep -v main | xargs -n 1 git branch -d
'';
};
};Most command-line tools have direct Nix equivalents:
| Homebrew | Nix Package | Location |
|---|---|---|
| bat | bat | home-manager/packages.nix |
| eza/exa | lsd | home-manager/packages.nix |
| fzf | fzf | home-manager/packages.nix |
| ripgrep | ripgrep | home-manager/packages.nix |
| starship | programs.starship | home-manager/shell.nix |
| gh | gh | home-manager/packages.nix |
GUI applications remain in Homebrew (via brew-nix):
- Ghostty
- Visual Studio Code
- Other macOS apps
If you have an existing Nix installation that conflicts:
# Backup existing Nix configuration
sudo mv /etc/nix/nix.conf /etc/nix/nix.conf.backup
# Restart Nix daemon
sudo launchctl stop org.nixos.nix-daemon
sudo launchctl start org.nixos.nix-daemonPlugins are now managed by Home Manager. To add a missing plugin:
- Find the plugin's GitHub repository
- Get the commit hash:
git ls-remote https://github.com/OWNER/REPO HEAD - Get the SHA256:
nix-prefetch-github OWNER REPO --rev COMMIT - Add to
home-manager/shell.nix
To add packages not in the default configuration:
- Search nixpkgs:
nix search nixpkgs PACKAGE_NAME - Add to
home-manager/packages.nix - Run
make switch
The new setup uses Homebrew only for GUI apps. If you have conflicts:
- List non-GUI formulae:
brew list --formula - Uninstall CLI tools available in Nix:
brew uninstall PACKAGE - Keep only casks and formulae not in nixpkgs
After migration, verify everything works:
# Run the test suite
make test
# Check Fish configuration
fish -c "echo 'Fish is working'"
# Verify Git configuration
git config --list
# Test common tools
bat --version
lsd --version
fzf --versionIf you need to rollback:
-
Restore from backup:
cp -R ~/.dotfiles-backup-*/.config ~/
-
Remove Nix dotfiles:
rm -rf ~/.dotfiles -
Reinstall old tools:
brew bundle --file=~/.dotfiles-backup-*/brew/Brewfile
- Reproducible: Same configuration on any Mac
- Declarative: All configuration in code
- Atomic updates: Updates succeed or fail as a unit
- Rollback capability: Easy to revert changes
- Better performance: Nix packages are optimized
- Cleaner system: No more symlink management
- Check existing issues in the repository
- Review
CLAUDE.mdfor development guidelines - Run
make helpfor available commands - Use
nix flake checkto validate configuration