For the automated setup run:
sh <(curl -L https://gist.githubusercontent.com/steinybot/085ef82571f4416506388c6a1e58637a/raw/9d71a417534813082fd02a4820eff92420c45040/bootstrap.sh)
For the manual setup follow the steps below:
Something dumb happens with Nix where on non-NixOS OSes the NIX_PATH
is not set (which is fine). There is a default defined in eval.cc but for whatever reason it doesn't work.
See NixOS/nixpkgs#149791 and nix-community/home-manager#2564.
To workaround this:
-
Add this to
~/.bash_profile
:[[ -f "${HOME}/.export" ]] && source "${HOME}/.export"
-
Add this to
~/.zshenv
:[[ -f "${HOME}/.export" ]] && source "${HOME}/.export"
-
Add this to
~/.export
:# Set NIX_PATH explicitly to work around https://github.com/NixOS/nixpkgs/issues/149791. # The path is the same as the default when NIX_PATH is not set (https://github.com/NixOS/nix/blob/master/src/libexpr/eval.cc). NIX_STATE_DIR="/nix/var/nix" export NIX_PATH="${NIX_PATH:-${HOME}/.nix-defexpr/channels:nixpkgs=${NIX_STATE_DIR}/profiles/per-user/root/channels/nixpkgs:${NIX_STATE_DIR}/profiles/per-user/root/channels}"
nix-channel --add https://github.com/LnL7/nix-darwin/archive/master.tar.gz darwin
nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
nix-channel --update
Backup your previous /etc/nix/nix.conf
file:
sudo mv /etc/nix/nix.conf /etc/nix/nix.conf.backup
nix-shell '<darwin>' -A install
darwin-rebuild switch
nix-shell '<home-manager>' -A install
home-manager switch