18 lines
322 B
Bash
18 lines
322 B
Bash
|
#!/usr/bin/env bash
|
||
|
|
||
|
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||
|
REPO_ROOT="${SCRIPT_DIR}/.."
|
||
|
cd $REPO_ROOT
|
||
|
|
||
|
# re-run as root
|
||
|
if [ "$EUID" -ne 0 ]; then
|
||
|
sudo ${BASH_SOURCE[0]} $@
|
||
|
exit
|
||
|
fi
|
||
|
|
||
|
FIRST_ARG="${1:-switch}"
|
||
|
|
||
|
shift
|
||
|
|
||
|
nixos-rebuild --flake "${REPO_ROOT}#$(hostname)" ${FIRST_ARG} $@
|