23 lines
599 B
Bash
23 lines
599 B
Bash
|
#!/usr/bin/env bash
|
||
|
|
||
|
set -eo pipefail
|
||
|
cd "$(dirname "$0")"
|
||
|
|
||
|
if ! command -v nix-build &> /dev/null
|
||
|
then
|
||
|
echo "Nix installation could not be found. Please follow the instructions linked below."
|
||
|
echo "https://nixos.org/manual/nix/unstable/installation/installing-binary.html#multi-user-installation"
|
||
|
exit
|
||
|
fi
|
||
|
|
||
|
mode="${1:-switch}"
|
||
|
host="nuc"
|
||
|
target="nuc@nuc.c3h"
|
||
|
#host="${2:-nuc}"
|
||
|
#target="${3:-$host.c3h}"
|
||
|
|
||
|
sources=$(nix-build nix/sources-dir.nix --no-out-link)
|
||
|
|
||
|
set -x
|
||
|
nixos-rebuild "$mode" --target-host "$target" --use-remote-sudo -I $sources -I "nixos-config=$PWD/hosts/$host/configuration.nix"
|