Configures my personal machines (NixOS and macOS).
If you spot any errors or mistakes, feel free to open a pull request!
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). -
Build and activate NixOS config:
sudo nixos-rebuild switch --flake .#thinkpad-x1 # the fragment can be dropped if it matches your current host name
# alternatively, using the `apps` provided by the flake:
sudo nix run .#rebuild-thinkpad-x1
- Activate home-manager:
sudo nix run .#hm-switch-thinkpad-x1
On a Thinkpad X1 you might have to remove the line
hardware.video.hidpi.enable = lib.mkDefault true;
from hardware-configuration.nix
if nixos-rebuild
complains about this option having no effect.
(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
- (Probably no longer needed.) 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:
nix run .#rebuild-macbook-pro-m1 # nix-darwin
nix run .#hm-switch-macbook-pro-m1 # home-manager
- 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.