Personal macOS Nix setup using flakes, nix-darwin, Home Manager, and nvf for Neovim.
flake.nixwires the system, Home Manager, and shared inputs.darwin/contains macOS system and Homebrew configuration.home/contains user-level modules for shell, tools, and editor setup.home/nvim/contains Neovim-focused modules and Lua customizations.hosts/my-macbook/contains host-specific overrides.hosts/work-macbook/contains a Home Manager-only target for a managed work Mac.
Neovim is managed through nvf in home/nvf.nix.
Key pieces:
home/nvim/options.nixfor core editor optionshome/nvim/lsp.nixfor LSP and Troublehome/nvim/languages.nixfor enabled language moduleshome/nvim/lint.nixfornvim-lintintegrationhome/nvim/formatters.nixforconform.nvimhome/nvim/keymaps.nixfor declarative mappingshome/nvim/config/*.luafor targeted runtime behavior split by concern
Most formatter/linter binaries are expected to come from project dev shells rather than this base config.
darwin-rebuild switch --flake .#my-macbook-
Install Xcode Command Line Tools:
xcode-select --install
-
Install Nix on macOS. This repo expects a standard multi-user install; Determinate's installer is the easiest path:
curl -fsSL https://install.determinate.systems/nix | sh -s -- install -
Open a new shell and verify Nix is available:
nix --version
-
Clone this repo to
~/.config/nix:git clone <repo-url> ~/.config/nix cd ~/.config/nix
-
Bootstrap
nix-darwinand apply the personal machine config:nix run nix-darwin/master#darwin-rebuild -- switch --flake ~/.config/nix#my-macbook -
Future updates can use either:
darwin-rebuild switch --flake ~/.config/nix#my-macbookor the installed alias:
nix-switch
For a Jamf-managed machine, apply only the user-level config:
home-manager switch --flake ~/.config/nix#work-macbookThis target intentionally skips nix-darwin, Homebrew ownership, macOS defaults, and default-browser activation.
It also avoids setting a global Git identity or exporting the OpenAI API key from Keychain by default.
-
Install Xcode Command Line Tools:
xcode-select --install
-
Install Nix on macOS. This repo expects a standard multi-user install; Determinate's installer is the easiest path:
curl -fsSL https://install.determinate.systems/nix | sh -s -- install -
Open a new shell and verify Nix is available:
nix --version
-
Clone this repo to
~/.config/nix:git clone <repo-url> ~/.config/nix cd ~/.config/nix
-
Set the work-machine username in
hosts/work-macbook/settings.nix:{ primaryUser = "your-macos-short-name"; }
-
Apply the managed-machine Home Manager target:
nix run home-manager/master -- switch --flake ~/.config/nix#work-macbook -
Future updates can use either:
home-manager switch --flake ~/.config/nix#work-macbookor the installed alias:
hm-switch
The work-macbook target reads the username from hosts/work-macbook/settings.nix and assumes Apple Silicon (aarch64-darwin).
- This repo keeps machine-specific changes in
hosts/. - Managed machines should prefer
homeConfigurationstargets so Nix only owns user-level packages and dotfiles. - Neovim plugin behavior is configured declaratively where practical, with a small Lua layer for editor runtime behavior.