From 26e2bcda8e92e2a06fa4fc148a37785e25568856 Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Sun, 26 May 2024 14:47:42 -0400 Subject: [PATCH] flake: include github url in clean-install script by default --- flake.nix | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/flake.nix b/flake.nix index ca69face..06bb01ff 100644 --- a/flake.nix +++ b/flake.nix @@ -48,29 +48,26 @@ packages."x86_64-linux".default = inputs.nixpkgs.legacyPackages."x86_64-linux".writeShellScriptBin "clean-install" '' # Check if an argument is provided 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 fi - # Construct the flake input - FLAKE_INPUT=$1 + HOST=$1 + FLAKE=github:alyraffauf/nixcfg#$HOST - # Display a warning message echo "Warning: Running this script will wipe the currently installed system." read -p "Do you want to continue? (y/n): " answer - # Check the user's response if [ "$answer" != "y" ]; then echo "Aborted." exit 0 fi - # Run the nix command with the updated flake input 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 - sudo nixos-install --no-root-password --root /mnt --flake $FLAKE_INPUT + sudo nixos-install --no-root-password --root /mnt --flake $FLAKE ''; nixosModules.default =