Skip to content

A nix-darwin developer setup for an M3 mac

License

Notifications You must be signed in to change notification settings

jiaqiwang969/nix-darwin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nix-darwin

Nix-darwin setup for an M3 mac, a variant of nix for macs.

first time setup

nix --extra-experimental-features 'nix-command flakes' \
  run nix-darwin -- switch --flake ~/.config/nix-darwin

build the system and switch to it

darwin-rebuild switch --flake ~/.config/nix-darwin

(needs root)

repo contents

  • flake.nix
    • main entrypoint
    • systems configuration: only one for a single mac
    • dependency setup: inputs with locked versions
    • configured with China mirrors for faster downloads
  • flake.lock
    • pinned versions of all dependencies
  • modules/
  • home/
    • home manager modules: user specific package configuration
    • most of these modules are pulled in from jiaqiwang969/nix-home-manager
    • includes configurations for:
      • GPG and SSH keys
      • Git configuration
      • Terminal tools (alacritty, tmux)
      • Development tools (emacs, neovim)
      • Window management (yabai, skhd)

key features

  • Multiple package channels:
    • nixpkgs-darwin (23.11 stable)
    • nixpkgs-unstable (latest unstable)
    • nixpkgs-locked (specific version for compatibility)
  • China mirrors configuration for faster downloads
  • Integrated development environment setup
  • Automated system maintenance
  • Custom overlays and patches

input flakes (dependencies)

All dependencies are locked to specific versions for reproducibility:

updating

Update all dependencies:

nix flake update

Update a single input:

nix flake lock --update-input <input-name>
# Example:
nix flake lock --update-input nixpkgs-firefox-darwin

After updating, rebuild the system:

darwin-rebuild switch

maintenance

Clean up old generations:

nix-collect-garbage -d

Optimize store:

nix store optimise

troubleshooting

If you encounter issues with applications:

  1. Check the nix logs: journalctl -u nix-daemon
  2. Clean up and rebuild:
    nix-collect-garbage -d
    darwin-rebuild switch
        
  3. Update flake lock file if needed:
    nix flake update
        

About

A nix-darwin developer setup for an M3 mac

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 47.6%
  • Nix 44.7%
  • Vim Script 5.4%
  • Other 2.3%