#!/usr/bin/env bash # This is a utility wrapper script around nixos-rebuild, intended for use within the root directory of the repository # as a local copy/clone. Might implement remote setups soon # SPDX-License-Identifier: MPL-2.0 set -xe HOSTNAME=$(hostname) NIXOS_HOSTNAME=${2:-"$HOSTNAME"} SUDO=${SUDO:"sudo"} if [[ $EUID != "0" ]]; then echo "Run me as root user again in order to deploy config changes." exit 1 fi if [[ $1 == "switch" ]]; then nixos-rebuild --verbose --show-trace --flake ".#${NIXOS_HOSTNAME}" switch elif [[ $1 == "boot" ]]; then nixos-rebuild --verbose --show-trace --flake ".#${NIXOS_HOSTNAME}" boot else echo "Unsupport command for this deployment wrapper" echo "Usage: $0 [hostname]" exit 1 fi