Troubleshooting Guide
Common issues and solutions for this Nix configuration.
System Build Errors
Section titled “System Build Errors””version mismatch” Error
Section titled “”version mismatch” Error”Problem: nix-darwin version doesn’t match nixpkgs
Solution:
# Update to latestnix flake update
# Or use same channel for bothinputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";inputs.nix-darwin.follows = "nixpkgs";
“hash mismatch” Error
Section titled ““hash mismatch” Error”Problem: Package hash doesn’t match expected
Solution:
# Get correct hashnix-prefetch-url https://example.com/file.tar.gz
# Or use fake hash, build will show correct onesha256 = lib.fakeSha256;
Infinite Recursion
Section titled “Infinite Recursion”Problem: Overlay or module refers to itself
Solution:
# ❌ Bad: infinite loopfinal: prev: { mypackage = final.mypackage.override { };}
# ✅ Good: use prevfinal: prev: { mypackage = prev.mypackage.override { };}
Activation Errors
Section titled “Activation Errors””nix.gc.automatic requires nix.enable”
Section titled “”nix.gc.automatic requires nix.enable””Problem: Garbage collection enabled but nix daemon disabled
Solution:
# Make GC conditionalnix.gc = lib.mkIf config.nix.enable { automatic = true; options = "--delete-older-than 14d";};
Permission Denied
Section titled “Permission Denied”Problem: Activation script needs sudo
Solution:
# First-time activation needs sudosudo nix run nix-darwin -- switch --flake .#hostname
# Subsequent builds don't need sudodarwin-rebuild switch --flake .#hostname
Package Issues
Section titled “Package Issues”Package Not Found
Section titled “Package Not Found”Solution:
# Update flakenix flake update
# Search againnix search nixpkgs package-name
# Check attribute pathnix eval nixpkgs#package-name --apply builtins.attrNames
Build Failure
Section titled “Build Failure”Solution:
# Show full errornix build .#package --show-trace
# Keep failed buildnix build .#package --keep-failedcd /tmp/nix-build-package-*
# Try without cachenix build .#package --option substitute false
Homebrew Issues
Section titled “Homebrew Issues”Cask Installation Fails
Section titled “Cask Installation Fails”Solution:
# Manual installbrew install --cask app-name
# Update Homebrewbrew update
# Check cask existsbrew search app-name
Hardware Security Issues
Section titled “Hardware Security Issues”Ledger Not Detected
Section titled “Ledger Not Detected”Solution:
- Check USB connection
- Unlock with PIN
- Open SSH/GPG Agent app
- Check logs:
tail -f ~/.local/share/ledger-gpg-agent.error.log
GPG Signing Fails
Section titled “GPG Signing Fails”Solution:
# Start agentledger-gpg-agent --homedir ~/.gnupg-ledger --server --verbose &
# Testecho "test" | gpg --homedir ~/.gnupg-ledger --clearsign
Quick Fixes
Section titled “Quick Fixes”# Rollback broken systemdarwin-rebuild switch --rollback
# Fix permissionssudo chown -R $USER ~/.nix-profile
# Clear cacherm -rf ~/.cache/nix
# Repair storenix-store --verify --check-contents --repair
See CLI Commands for more commands.