Nix configuration flake for my personal machines (macOS and NixOS).
💡Inspired by buntec's setup
After installing NixOS from a USB drive, follow these steps:
-
Clone this repo and
cd
into it. -
Copy
/etc/nixos/hardware-configuration.nix
into./system
(OK to overwrite existing dummy file). -
Finally, to build and activate in one step using the
apps
provided by the flake
nix run .#rebuild-nixos # system configuration
nix run .#hm-switch-nixos # dotfiles and home configuration
(Heavily inspired by this gist)
To bootstrap a fresh macOS install, follow these steps:
- Install Homebrew (only needed for managing GUI apps via casks)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- Install Nix:
curl -L https://nixos.org/nix/install | sh
- Enable flakes
mkdir -p ~/.config/nix
cat <<EOF > ~/.config/nix/nix.conf
experimental-features = nix-command flakes
EOF
- To work around this issue
sudo mv /etc/nix/nix.conf /etc/nix/.nix-darwin.bkp.nix.conf
- Clone this repo,
cd
into it, then build and activate with the following commands:
nix run .#rebuild-macbook-air-m2 # system configuration
nix run .#hm-switch-macbook-air-m2 # dotfiles and home configuration
- Uninstall Homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
-
Delete everything under
~/.config
and any other "dot files" in your home directory. -
Delete all applications that are listed as Homebrew casks in
./system/configuration-darwin.nix
-
Follow the steps for a fresh macOS install.