clean-install: prompt for host

This commit is contained in:
Aly Raffauf 2024-07-17 11:07:29 -04:00
parent e27e678f3e
commit 1fd64d4404
2 changed files with 4 additions and 8 deletions

View file

@ -51,7 +51,7 @@ Substitute `$HOSTNAME` for whichever hostname you have chosen. Reboot to apply t
### Installing from Live USB ### Installing from Live USB
> :red_circle: **This will erase your computer's disk** as specified by the host configuration, installing a fresh copy of NixOS. Backup first! > :red_circle: **This will erase your computer's disk** as specified by the host configuration, installing a fresh copy of NixOS. Backup first!
If you want to install NixOS from this flake, run the following commands, ideally from a NixOS live environment, substituting `$HOSTNAME` with a NixOS configuration specified in `flake.nix`. If you want to install NixOS from this flake, run the following commands, ideally from a NixOS live environment, providing the hostname associated with a NixOS configuration specified in `flake.nix`.
```console ```console
sudo nix --experimental-features "nix-command flakes" run github:alyraffauf/nixcfg -- $HOSTNAME sudo nix --experimental-features "nix-command flakes" run github:alyraffauf/nixcfg
``` ```

View file

@ -1,11 +1,7 @@
# Check if an argument is provided read -p "Which host are you installing? " HOST
if [ $# -eq 0 ]; then
echo "Error: Please provide a valid hostname as an argument."
exit 1
fi
HOST=$1
FLAKE=github:alyraffauf/nixcfg#$HOST FLAKE=github:alyraffauf/nixcfg#$HOST
echo "Installing from $FLAKE"
echo "Warning: Running this script will wipe the currently installed system." echo "Warning: Running this script will wipe the currently installed system."
read -p "Do you want to continue? (y/n): " answer read -p "Do you want to continue? (y/n): " answer