macOS dotfiles managed with Nix flakes, nix-darwin, and home-manager.
-
Install Xcode Command Line Tools and Homebrew (if not already installed):
xcode-select --install /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" -
Install Determinate Nix (if not already installed) 1:
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
-
Clone this repository:
git clone https://github.com/mfyuu/dotfiles.git ~/.dotfiles -
Apply the nix-darwin configuration 2 3:
# Replace <hostname> with your machine name (M4Pro, M4Air, etc.) sudo nix run nix-darwin -- switch --flake ~/.dotfiles#<hostname>
-
Reload your shell:
exec zsh
Run these commands from the dotfiles directory (~/.dotfiles):
# Update flake.lock (fetch latest nixpkgs, nix-darwin, home-manager)
nix run .#update
# Build and apply configuration (Homebrew is also updated automatically)
nix run .#switch
# Dry run (build without applying)
nix run .#buildNote
If running from outside the dotfiles directory, replace . with the path to the repository (e.g., nix run ~/.dotfiles#update).
Zsh startup time is continuously tracked in CI. Every push to main runs 50 iterations with hyperfine and records the results.
Note
These numbers are from GitHub Actions runners and may not reflect local performance. Use the trend to catch regressions, not as absolute measurements.
Footnotes
-
The first run may fail. If it does, just run the same command again and it should succeed. ↩
-
This sets
LocalHostNameandComputerNameviascutil, so it works as the initial hostname setup even if the machine has no custom hostname configured yet. ↩ -
If Homebrew is not installed, the command will fail with an installation prompt. Install Homebrew first (see step 1), then re-run this command. ↩