Declarative macOS setup using Nix Darwin + Home Manager with integrated theming.
~/nix/
├── flake.nix # Flake with nix-darwin, home-manager, stylix, nix-homebrew
├── darwin-configuration.nix # Host-level config (imports modules/system/default.nix)
├── home.nix # User-level config (Home Manager)
├── modules/ # Modular configs
│ ├── system/ # nix-darwin (system) modules
│ │ ├── default.nix # Aggregator: imports sibling system modules
│ │ ├── core.nix # Core: nix/nixpkgs/programs/terminfo
│ │ ├── defaults.nix # macOS defaults (Dock + UI)
│ │ ├── packages.nix # environment.systemPackages (CLI/dev tools)
│ │ ├── homebrew.nix # Homebrew brews/casks (+ activation prefs)
│ │ ├── fonts.nix # System fonts
│ │ ├── applications.nix # Alias Nix + HM apps into /Applications
│ │ └── proxychains.nix # Proxychains (optionized)
│ ├── cli/fzf.nix # FZF (Home Manager)
│ ├── desktop/wallpaper.nix # Wallpaper setup (Home Manager)
│ ├── editor/neovim.nix # Neovim + theme (Home Manager)
│ ├── git/git.nix # Git (Home Manager)
│ ├── multiplexer/tmux.nix # Tmux + statusline (Home Manager)
│ ├── shell/zsh.nix # Zsh + Powerlevel10k (Home Manager)
│ └── terminal/alacritty.nix # Alacritty (Home Manager)
└── scripts/
├── switch-theme.sh # Interactive theme/prompt switcher
└── tmux-stats.sh # Tmux helper
- Install Nix:
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
- Bootstrap nix-darwin (first time only):
sh -c "$(curl -L https://github.com/LnL7/nix-darwin/releases/latest/download/install)"
- Apply configuration:
cd ~/nix && sudo darwin-rebuild switch --flake .#cloudhome-manager switch --flake .#alevsk
- System changes:
sudo darwin-rebuild switch --flake ~/nix#cloud - User changes:
home-manager switch --flake ~/nix#alevsk - Helpful aliases (available in the shell):
rebuild-system,rebuild-home,rebuild-all,switch-theme,nix-gc
- Nix (system): edit
modules/system/packages.nixenvironment.systemPackages = with pkgs; [ my-package ];(keep list alphabetized)
- Nix (user): edit
home.nixhome.packages = with pkgs; [ my-package ];
- Homebrew (CLI): edit
modules/system/homebrew.nixhomebrew.brews = [ "my-brew" ];(keep list alphabetized)
- Homebrew (Apps): edit
modules/system/homebrew.nixhomebrew.casks = [ "my-app" ];(keep list alphabetized)
- Flake attributes: system
.#cloud, user.#alevsk. - Homebrew is integrated via
nix-homebrewin flake.nix and configured inmodules/system/homebrew.nix. - Dock items and application aliases are created during system activation (see
modules/system/applications.nix). - Both system (nix-darwin) and user (Home Manager) apps are aliased into
/Applicationsso Spotlight/Launchpad can find them easily.
- Use Nix for CLI/dev tools and libraries (reproducible, easy pinning via flakes).
- Use Homebrew for GUI apps/macOS bundles (better support and updates for many apps).
- Dock apps should point to Homebrew-managed apps under
/Applicationswhere possible (exceptions allowed by choice).
- The activation script aliases:
- System apps from
environment.systemPackages’*/Applications/*.appinto/Applications. - Home Manager apps from all
*home-manager-applications*/Applications/*.appinto/Applications.
- System apps from
- This provides a single UX surface in
/Applications; HM’s default~/Applications/Home Manager Appsmay also exist but/Applicationsis considered primary in this setup.
- Update inputs:
nix flake update - Garbage collect:
nix-collect-garbage -d - Validate flake:
nix flake check - Inspect flake:
nix flake show - Search packages:
nix search nixpkgs <name> - Rollback:
sudo darwin-rebuild rollback(system),home-manager rollback(user)
- Fast switch (interactive): run
switch-themeor~/nix/scripts/switch-theme.sh - Manual edit: update in
home.nixcurrentThemeName = "nord";# nord, dracula, tokyonight, ocean, defaultpromptStyle = "lean";# lean, classic, rainbowautoStartTmux = false;# auto-start tmux on new terminals
- Apply theme changes:
home-manager switch --flake ~/nix#alevsk - Integration: Stylix + nix-colors propagate colors to Zsh, tmux, fzf, Neovim, Alacritty.
- Zsh:
modules/shell/zsh.nix - Alacritty:
modules/terminal/alacritty.nix - Neovim:
modules/editor/neovim.nix - Git:
modules/git/git.nix - Tmux:
modules/multiplexer/tmux.nix - FZF:
modules/cli/fzf.nix - Wallpaper:
modules/desktop/wallpaper.nix
- Use
sudowithdarwin-rebuildfor system changes. - Ensure you run from
~/nixor point--flakeat the repo. - If builds fail, check
.nixsyntax and attribute names (cloud,alevsk).
- Nix packages: https://search.nixos.org/
- nix-darwin: https://github.com/LnL7/nix-darwin
- Home Manager: https://github.com/nix-community/home-manager
- Stylix: https://github.com/nix-community/stylix
- nix-colors: https://github.com/Misterio77/nix-colors