flake: include github url in clean-install script by default

This commit is contained in:
Aly Raffauf 2024-05-26 14:47:42 -04:00
parent ef40f71791
commit 26e2bcda8e

View file

@ -48,29 +48,26 @@
packages."x86_64-linux".default = inputs.nixpkgs.legacyPackages."x86_64-linux".writeShellScriptBin "clean-install" '' packages."x86_64-linux".default = inputs.nixpkgs.legacyPackages."x86_64-linux".writeShellScriptBin "clean-install" ''
# Check if an argument is provided # Check if an argument is provided
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
echo "Error: Please provide a flake as an argument." echo "Error: Please provide a valid hostname as an argument."
exit 1 exit 1
fi fi
# Construct the flake input HOST=$1
FLAKE_INPUT=$1 FLAKE=github:alyraffauf/nixcfg#$HOST
# Display a warning message
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
# Check the user's response
if [ "$answer" != "y" ]; then if [ "$answer" != "y" ]; then
echo "Aborted." echo "Aborted."
exit 0 exit 0
fi fi
# Run the nix command with the updated flake input
sudo nix --experimental-features "nix-command flakes" run \ sudo nix --experimental-features "nix-command flakes" run \
github:nix-community/disko -- --mode disko --flake $FLAKE_INPUT github:nix-community/disko -- --mode disko --flake $FLAKE
# Install NixOS with the updated flake input and root settings # Install NixOS with the updated flake input and root settings
sudo nixos-install --no-root-password --root /mnt --flake $FLAKE_INPUT sudo nixos-install --no-root-password --root /mnt --flake $FLAKE
''; '';
nixosModules.default = nixosModules.default =