#!/usr/bin/env bash

set -e

# Get the current directory.
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

# Get the target hostname.
echo -n "Enter this machine's hostname as in flake.nix: "
read HOSTNAME

# Let Nix set things up. :)
sudo nixos-rebuild --flake "${SCRIPT_DIR}#${HOSTNAME}" $@ switch

