mirror of
https://github.com/alyraffauf/nixcfg.git
synced 2024-11-25 14:31:54 -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" ''
|
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 =
|
||||||
|
|
Loading…
Reference in a new issue