[ "$(id -u)" != 0 ] || { log_status "ERROR: running as root" exit 1 } [ "$(nix --version)" = "nix (Nix) $(cat version)" ] || { log_status "installing Nix core tools" sh ./install } . ~/.nix-profile/etc/profile.d/nix.sh gcroots="$OLDPWD"/.cache/nix/gcroots log_status "registering Nix dependencies into $(realpath -m --relative-to="$OLDPWD" $gcroots)/" rm -rf $gcroots # NOTE: remove dependencies no longer set in shell.nix mkdir -p $gcroots nix-instantiate >/dev/null shell.nix \ --indirect --add-root $gcroots/shell.drv nix-store >/dev/null ${OFFLINE:+--option substituters ""} \ --indirect --add-root $gcroots/shell.dep \ --realise $(nix-store --query --references $gcroots/shell.drv) use nix shell.nix --pure watch_file shell.nix