mirror of
https://github.com/alyraffauf/nixcfg.git
synced 2024-11-22 01:33:55 -05:00
added install script
This commit is contained in:
parent
cbb61849d5
commit
5a55f23a13
44
install.sh
Normal file
44
install.sh
Normal file
|
@ -0,0 +1,44 @@
|
|||
#!/bin/sh
|
||||
# Copyright 2024 Aly Raffauf
|
||||
#
|
||||
# This program is free software: you can redistribute it
|
||||
# and/or modify it under the terms of the GNU General Public
|
||||
# License as published by the Free Software Foundation, either
|
||||
# version 3 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Automatically partitions drive and installs NixOS from a given flake,
|
||||
# provided your flake includes a valid disko configuration.
|
||||
|
||||
# Check if an argument is provided
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "Error: Please provide a flake as an argument."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Construct the flake input
|
||||
FLAKE_INPUT=$1
|
||||
|
||||
# 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
|
||||
|
||||
# Install NixOS with the updated flake input and root settings
|
||||
sudo nixos-install --no-root-password --root /mnt --flake $FLAKE_INPUT
|
Loading…
Reference in a new issue