Darwin

Updated: September 7, 2025

Install Darwin + Home Manager + Nix

This will guide to getting started.


Table of Contents


Resources

Nix

The first thing we need to do is install Nix Pakage Manager from determinate systems.
It can be cleanly uninstalled and starts with flakes enabled.

# this will install nix
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install

Answer “no” when it asks to install Determinate Nix (As of 2024: Does not work with Darwin)
Keep in mind that we will not be using this package manager to imperatively install Nix packages.
So we will not be using the nix-env command, it defeats the purpose of nix tbh.

# check that nix is installed
nix --version
nix run "nixpkgs#hello"

# see where nix is installed
type nix

# if nix path is missing just source it again
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh

Flake

The second thing we need to do is create a flake and place it in a git repository.
This will us to version control our changes, and allow it to be pulled to other systems.
We need to first install nix-darwin before we can use it.

# Bootstrap nix-darwin
mkdir nix-darwin-config
cd nix-darwin-config

# Generate a flake.nix
nix flake init -t nix-darwin

From this point we want to make sure we have a working shell environment in our flake.
If we don’t have zsh set, we may lose our nix and nix-darwin paths after a reboot.
Instead of bootstraping nix-darwin we could use nix to build the flake ahead of time:

# build flake into a result
nix build .#darwinConfigurations.<name>.system

# activate the result
sudo ./result/activate

After all this is done, just darwin-rebuild should be able to take over from here!

sudo darwin-rebuild switch --flake .#hostname