From f8de34054ec8b64dd0f80e15d1bd884056c5253e Mon Sep 17 00:00:00 2001 From: randomuser Date: Thu, 13 Jul 2023 12:59:44 -0500 Subject: [PATCH] add a simple installer for nixos configs --- nonpure/install.sh | 77 ++++++++++++++++++++++++++++++++ nonpure/traditional_bootstrap.sh | 1 + 2 files changed, 78 insertions(+) create mode 100644 nonpure/install.sh create mode 100644 nonpure/traditional_bootstrap.sh diff --git a/nonpure/install.sh b/nonpure/install.sh new file mode 100644 index 0000000..e8750b4 --- /dev/null +++ b/nonpure/install.sh @@ -0,0 +1,77 @@ +if [ "$(id -u)" -eq 1000 ]; then + printf "switch to the root user, and try again.\n" + exit 1 +fi + +lsblk + +read -p "Drive name? (/dev/vda): " DRIVE +read -p "NixOS configuration? (virtbox): " NIXOS_CONFIG +read -p "Reboot? (yes/no, default 'yes'): " REBOOT + +umount -f /mnt/boot +umount -f /mnt +swapoff -a + +nix-env -iA nixos.git + +if [ -z "$DRIVE" ]; then + DRIVE="/dev/vda" +fi + +if [ -z "$NIXOS_CONFIG" ]; then + NIXOS_CONFIG="virtbox" +fi + +if [ -z "$REBOOT" ]; then + REBOOT="yes" +fi + +fdisk "$DRIVE" <