#!/bin/sh -eux cd "${0%/*}" chmod -R g-rwx,o-rwx "$PWD/private/root" trap 'git reset private/root private/hosts/*/root' EXIT git rm -rf --cached --ignore-unmatch private/root private/hosts/*/root # prevent copying to /nix/store sudo ln -sfn "$PWD/private/root" /root/private # To build offline, use: --offline sudo time nixos-rebuild switch --flake . "$@"