mirror of
https://github.com/alyraffauf/nixcfg.git
synced 2024-11-21 20:33:55 -05:00
flake: include github url in clean-install script by default
This commit is contained in:
parent
ef40f71791
commit
26e2bcda8e
13
flake.nix
13
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 =
|
||||
|
|
Loading…
Reference in a new issue