2024-05-14 09:29:16 -05:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# Change into script dir.
|
|
|
|
cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null || exit
|
|
|
|
nixosDir=$(pwd)
|
|
|
|
|
|
|
|
# Get short hostname to work with host specific configurations.
|
|
|
|
host=$(hostname -s)
|
|
|
|
if [[ -n $nixHostOverride ]]; then
|
|
|
|
host=$nixHostOverride
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Confirm host configuration is available; If not, we should not continue.
|
2024-05-16 00:13:09 -05:00
|
|
|
if ! grep -q "nixosConfigurations.$host " flake.nix; then
|
2024-05-14 09:29:16 -05:00
|
|
|
host="default"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Install NixOS.
|
|
|
|
# shellcheck disable=SC2068
|
|
|
|
nix --extra-experimental-features 'nix-command flakes' run 'github:nix-community/disko#disko-install' -- --impure --flake "path:$nixosDir/#$host" $@
|