2024-07-09 19:17:53 -04:00
|
|
|
# Check if an argument is provided
|
|
|
|
if [ $# -eq 0 ]; then
|
2024-07-09 23:34:43 -04:00
|
|
|
echo "Error: Please provide a valid hostname as an argument."
|
|
|
|
exit 1
|
2024-07-09 19:17:53 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
HOST=$1
|
|
|
|
FLAKE=github:alyraffauf/nixcfg#$HOST
|
|
|
|
|
|
|
|
echo "Warning: Running this script will wipe the currently installed system."
|
|
|
|
read -p "Do you want to continue? (y/n): " answer
|
|
|
|
|
|
|
|
if [ "$answer" != "y" ]; then
|
2024-07-09 23:34:43 -04:00
|
|
|
echo "Aborted."
|
|
|
|
exit 0
|
2024-07-09 19:17:53 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
sudo nix --experimental-features "nix-command flakes" run \
|
2024-07-09 23:34:43 -04:00
|
|
|
github:nix-community/disko -- --mode disko --flake $FLAKE
|
2024-07-09 19:17:53 -04:00
|
|
|
|
|
|
|
# Install NixOS with the updated flake input and root settings
|
2024-07-09 23:34:43 -04:00
|
|
|
sudo nixos-install --no-root-password --root /mnt --flake $FLAKE
|