macOS dotfiles managed by Nix (nix-darwin + home-manager). See AGENTS.md for the layout and conventions.
Hosts are selected by user name: nagaoka.yuta → work, otherwise personal.
Run in a regular terminal (Ghostty, Terminal.app). sudo needs a TTY to ask for the password.
curl -sL https://raw.githubusercontent.com/ikanago/dotfiles/main/install.sh | bashIt installs Nix, clones this repository to ~/ghq/github.com/ikanago/dotfiles, backs up /etc files and runs the first switch.
- Install Nix with the official installer.
Open a new terminal afterwards.
curl -fsSL https://nixos.org/nix/install | sh -s -- --daemon - Clone this repository. The path is fixed (
my.host.dotfilesDir) because config files are symlinked into it.git clone https://github.com/ikanago/dotfiles ~/ghq/github.com/ikanago/dotfiles cd ~/ghq/github.com/ikanago/dotfiles
- Move away the files the Nix installer wrote. nix-darwin refuses to overwrite them.
If the switch stops with
sudo mv /etc/nix/nix.conf /etc/nix/nix.conf.before-nix-darwin sudo mv /etc/zshrc /etc/zshrc.before-nix-darwin sudo mv /etc/bashrc /etc/bashrc.before-nix-darwin
Unexpected files in /etc, move the listed files the same way. - Run the first switch.
justis not installed yet, so run it throughnix run.nix --extra-experimental-features "nix-command flakes" run nixpkgs#just -- bootstrap - Open a new terminal. From now on,
justanddarwin-rebuildare on PATH.
- Existing files in the way (
~/.zshrc,~/.config/nvim, ...) are renamed to*.before-nix. Delete them once everything works. - Homebrew runs with
cleanup = "zap": formulae, casks and taps not listed innix/darwin/homebrew.nixare removed on every switch. - If Homebrew stops with
Refusing to load ... from untrusted tap, uninstall that package by hand first (brew trust <tap>thenbrew uninstall).
just switch # apply
just build # build without applying (no sudo)
just update # update flake.lock
just fmt # format Nix filesRollback: sudo darwin-rebuild --rollback