My personal macOS dotfiles managed declaratively with Nix flakes through nix-darwin backed by home-manager.
nix/
├── flake.nix # main flake config
├── darwin/ # macOS system settings
│ ├── default.nix
│ ├── settings.nix
│ └── homebrew.nix
├── home/ # Home Manager config
│ ├── default.nix # contains non-explicitly configured packages as well
│ └── <program>.nix
├── scripts/ # custom shell scripts
│ └── <script>.sh
└── hosts/
└── <name>/ # host to configure
└── configuration.nix
- Install Nix (docs)
- Clone this repo to
~/.config/nix - Edit names/usernames around (eg.
flake.nixandhome/git.nix) - Run:
darwin-rebuild switch --flake .#<name> - Or nix-darwin directly for the first time run:
sudo nix run nix-darwin --extra-experimental-features nix-command --extra-experimental-features flakes -- switch --flake ~/.config/nix
- CLI tools:
home/default.nix - GUI apps:
darwin/homebrew.nix - Host config:
hosts/<name>/configuration.nix
See Nix manual. Original files from bgub.