When trying to reinstall Nix using the official installer, you might run into the following error (the UID might vary)
---- oh no! --------------------------------------------------------------------
It seems the build group nixbld already exists, but
with the UID 30000. This script can't really handle
that right now, so I'm going to give up.
You can export NIX_BUILD_GROUP_ID=30000 and re-run.
In my case, exporting NIX_BUILD_GROUP_ID did not change anything. What did work is deleting build users created by a previous installation (via). Since I will never find that issue again, I'm publishing it on Gist with annotations added by myself.
# Nix creates multiple build users to perform package builds in isolation, let's iterate over them
for i in {1..32}; do
# Delete each Nix build user (_nixbld1, _nixbld2, etc.)
sudo dscl . delete /Users/_nixbld$i
done
# Delete the Nix build group
sudo dscl . delete /Groups/nixbld