Configuration for my personal machines (both macOS and NixOS).
Credits to buntec/nix-config; my config started as a clone of that repo.
After installing NixOS from a USB drive, follow these steps:
-
Clone this repo and
cd
into it. Usenix-shell -p git
to access git. -
Copy
/etc/nixos/hardware-configuration.nix
into./system
(OK to overwrite existing dummy file). -
Build and activate NixOS config:
sudo nixos-rebuild switch --flake .#lenovo-desktop # the fragment can be dropped if it matches your current host name
# alternatively, using the `apps` provided by the flake:
sudo nix run .#rebuild-lenovo-desktop
- Activate home-manager:
sudo nix run .#hm-switch-lenovo-desktop
- After the initial installation, again
cd
into the repo, and activate direnv by typingdirenv allow
. Now you can use the simpler commands to for rebuild and hm switch:
# rebuild switch
sudo just rebuild
# hm switch
just hm-switch
(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 --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
- Clone this repo,
cd
into it, then build and activate with one command:
nix run .#rebuild-macbook-pro-m1 # nix-darwin
nix run .#hm-switch-macbook-pro-m1 # home-manager
- After the initial installation, again
cd
into the repo, and activate direnv by typingdirenv allow
. Now you can use the simpler commands to for rebuild and hm switch:
# rebuild switch
just rebuild
# hm switch
just hm-switch
# rebuild & hm-switch
just
- 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.