chore: Finish up install scripts.

This commit is contained in:
greysoh 2024-07-19 13:57:30 -04:00
parent 3c291b8a95
commit 72b9dd88e5
Signed by: imterah
GPG key ID: 8FA7DD57BA6CEA37
8 changed files with 72 additions and 14 deletions

16
nixinfra/update.sh Normal file
View file

@ -0,0 +1,16 @@
#!/usr/bin/env bash
if [[ "$NIX_BUILD_ID" == "" ]]; then
echo "ERROR: You have held a (potentially) broken install!"
echo "NIX_BUILD_ID is not set (should be set by default!)"
echo "Please set NIX_BUILD_ID manually. i.e:"
echo "NIX_BUILD_ID=kitteh-node-1/agent updater"
exit 1
fi
if [[ "$UID" != "0" ]]; then
sudo $0 $@
exit $?
fi
export NIX_PATH="$(printf $NIX_PATH | sed --expression="s#/etc/nixos/configuration.nix#/etc/nixos/nixinfra/$NIX_BUILD_ID.nix#g")"
nixos-rebuild switch --upgrade