macOS setup managed by a nix flake (nix-darwin + home-manager). Config files
stay plain files in this repo; modules/home/lib/stow.nix links them into
$HOME as out-of-store symlinks, so editing a dotfile never needs a rebuild.
| Package | Contents |
|---|---|
term/ |
bash, zsh, alacritty, tmux, scripts (tmux-sessionizer) |
nvim/ |
Neovim (pure Lua, native vim.pack) |
wm/ |
AeroSpace + sketchybar |
git/ |
git aliases and config |
-
Command line tools (provides
gitfor the clone):xcode-select --install
-
Nix — official upstream installer:
sh <(curl -L https://nixos.org/nix/install) -
Clone — the path is load-bearing (symlinks point into it; anywhere else and they dangle). HTTPS needs no auth; add an SSH key later for pushing.
mkdir -p ~/Private/github.com/npx git clone https://github.com/npx/.dotfiles.git ~/Private/github.com/npx/.dotfiles cd ~/Private/github.com/npx/.dotfiles
-
First switch —
darwin-rebuilddoesn't exist yet, and neither do flakes-enablement or the machine's hostname, so all three are spelled out:sudo nix run nix-darwin/master#darwin-rebuild \ --extra-experimental-features "nix-command flakes" \ -- switch --flake .#MacBook-Pro
This one command installs Homebrew itself (nix-homebrew), all casks and packages, dotfile symlinks, macOS defaults, the "vpn proxy" network location, and renames the machine — later rebuilds match the hostname automatically.
-
Setup script — the imperative leftovers nix deliberately doesn't own (node via fnm, claude CLI,
~/.secretstemplate). Idempotent:./setup
-
Manual follow-ups (by design, not omissions):
- fill
~/.secretsfrom the password manager - git identity is deliberately unset — git asks at the first commit; set it globally or per repo (work vs private)
- TCC permission clicks: AeroSpace → Accessibility
- App Store sign-in, login items
- Mason LSP tools install themselves at first nvim launch
- fill
-
Optional: make bare
sudo darwin-rebuild switchwork without the--flakeargument:sudo ln -s ~/Private/github.com/npx/.dotfiles /etc/nix-darwin
Same repo, host desktop. Boot the minimal ISO,
sudo -i, then:
-
Partition + label — labels are load-bearing if you keep the committed hardware config (device varies; the VM was
/dev/vda):parted /dev/vda -- mklabel gpt parted /dev/vda -- mkpart ESP fat32 1MB 512MB parted /dev/vda -- set 1 esp on parted /dev/vda -- mkpart root ext4 512MB 100% mkfs.fat -F 32 -n boot /dev/vda1 mkfs.ext4 -L nixos /dev/vda2 mount /dev/disk/by-label/nixos /mnt mkdir -p /mnt/boot mount -o umask=077 /dev/disk/by-label/boot /mnt/boot -
Clone to the load-bearing path:
nix-shell -p git mkdir -p /mnt/home/ybaron/Private/github.com/npx git clone https://github.com/npx/.dotfiles.git \ /mnt/home/ybaron/Private/github.com/npx/.dotfiles
-
Hardware config — replace the committed placeholder with reality (commit it once the machine is online):
nixos-generate-config --root /mnt --show-hardware-config \ > /mnt/home/ybaron/Private/github.com/npx/.dotfiles/hosts/desktop/hardware-configuration.nix -
Install (root stays locked;
ybaronis wheel):nixos-install --root /mnt --no-root-passwd \ --flake /mnt/home/ybaron/Private/github.com/npx/.dotfiles#desktop nixos-enter --root /mnt -c 'passwd ybaron' -
Reboot without the ISO → tuigreet → pick
i3(or thesteamconsole session). First login:sudo chown -R ybaron: /home/ybaron/Private cd ~/Private/github.com/npx/.dotfiles && ./setup
Then commit + push the hardware config.
# apply nix-level changes (packages, modules, casks, defaults)
sudo darwin-rebuild switch --flake ~/Private/github.com/npx/.dotfiles # mac
sudo nixos-rebuild switch --flake ~/Private/github.com/npx/.dotfiles # nixos| Change | Where | Then |
|---|---|---|
| Edit an existing dotfile | edit it | nothing — symlinks are live |
| New CLI tool | modules/home/core.nix (both machines) or dev.nix (dev-only) |
rebuild |
| New GUI app | homebrew.casks in modules/darwin/default.nix |
rebuild |
New top-level entry inside a package (e.g. term/.config/newtool/) |
create it | git add it, then rebuild |
| New package dir | add it to a stow [ ... ] list in modules/home/*.nix |
rebuild |
Standing exceptions: sketchybar is a brew formula (aerospace launches it via PATH), claude is the native installer.
~/.secretsand~/.gitconfig-identity — machine-local, recreated by hand- node versions — fnm, imperative (
~/.local/share/fnm) - VM images and their network settings — the UTM app is a cask, its contents are backed up separately
- switching network locations — manual (menu bar or
scselect)