24 lines
558 B
Bash
Executable file
24 lines
558 B
Bash
Executable file
#!/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
|
|
|
|
MODE=${1-}
|
|
if [ -z "${MODE}" ]; then
|
|
MODE=switch
|
|
else
|
|
shift
|
|
fi
|
|
|
|
|
|
sudo cpupower frequency-set -g performance
|
|
nix build --keep-failed --log-format internal-json -v "${REPO_ROOT}#nixosConfigurations.$(hostname).config.system.build.toplevel" "$@" 2>&1 | nom --json
|
|
nixos-rebuild --fast --flake "${REPO_ROOT}#$(hostname)" "$MODE" "$@"
|