My Nix configuration for macOS (nix-darwin + home-manager) and a Linux VPS profile.
flake.nix— entry point; defines thekarolkozakowskidarwin profile and thekarolkozakowski-vpsLinux profiledarwin.nix— macOS system config (Homebrew taps/casks, nix-darwin settings)home.nix— macOS user packages and shell confighome-vps.nix— Linux VPS user packages and shell configmodules/shared.nix— packages and zsh config shared by both profilesnvim/— Neovim configurationMakefile—switch,update,check,gc, etc.
Assumes Apple Silicon (aarch64-darwin).
Use the Determinate Systems installer (handles flakes + uninstall cleanly):
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- installOpen a new shell so nix is on PATH.
The flake must live at ~/.config/home-manager (the Makefile and aliases assume that path):
mkdir -p ~/.config
git clone <this-repo-url> ~/.config/home-manager
cd ~/.config/home-managerThe username karolkozakowski is hardcoded. If your macOS user is different, search-and-replace it in:
flake.nix—darwinConfigurations."karolkozakowski"andhome-manager.users.karolkozakowskidarwin.nix—users.users.karolkozakowskiandsystem.primaryUserhome.nix—home.username,home.homeDirectory, and thePATHline ininitContentMakefile—PROFILE := karolkozakowski
There's no darwin-rebuild yet, so run it via nix:
sudo nix run nix-darwin -- switch --flake .#karolkozakowskiAfter this completes, /run/current-system/sw/bin/darwin-rebuild exists and the Makefile takes over.
make switch # apply current config
make update # update flake inputs, then switch
make check # build without activating
make gc # garbage-collect old generations (>7 days)The shared zsh config also exposes these as aliases: switch, update, clean, homemanager.
nix run home-manager/master -- switch --flake .#karolkozakowski-vpsAfter that, make switch works the same way (it detects Linux via uname).
nixpkgstracksnixpkgs-unstable.homebrew.onActivation.cleanup = "zap"— Homebrew packages not listed indarwin.nixwill be removed on switch. Add casks/brews there, not viabrew installdirectly.allowUnfree = trueis set so things likeclaude-codeand_1password-clibuild.- The MCP module comes from the
mcpsflake input (github:roman/mcps.nix).