40 lines
		
	
	
		
			851 B
		
	
	
	
		
			Bash
		
	
	
	
	
	
			
		
		
	
	
			40 lines
		
	
	
		
			851 B
		
	
	
	
		
			Bash
		
	
	
	
	
	
#!/bin/bash
 | 
						|
 | 
						|
# Define the disk to partition
 | 
						|
DISK="/dev/sdX"
 | 
						|
 | 
						|
# Create a new partition table
 | 
						|
parted $DISK -- mklabel gpt
 | 
						|
 | 
						|
# Create a 512MB partition for UEFI boot
 | 
						|
parted $DISK -- mkpart ESP fat32 1MiB 513MiB
 | 
						|
parted $DISK -- set 1 boot on
 | 
						|
 | 
						|
# Create the root partition
 | 
						|
parted $DISK -- mkpart primary ext4 513MiB 100%
 | 
						|
 | 
						|
# Format the partitions
 | 
						|
mkfs.fat -F32 ${DISK}1
 | 
						|
mkfs.ext4 ${DISK}2
 | 
						|
 | 
						|
# Mount the partitions
 | 
						|
mount ${DISK}2 /mnt
 | 
						|
mkdir -p /mnt/boot
 | 
						|
mount ${DISK}1 /mnt/boot
 | 
						|
 | 
						|
# Install NixOS
 | 
						|
nixos-generate-config --root /mnt
 | 
						|
 | 
						|
# Clone the configuration repository
 | 
						|
git clone https://git.luke-else.co.uk/luke-else/nixos-config.git /mnt/etc/nixos
 | 
						|
 | 
						|
# Install NixOS using the cloned configuration
 | 
						|
nixos-install --root /mnt
 | 
						|
 | 
						|
# Set the root password
 | 
						|
echo "Please set the root password:"
 | 
						|
passwd
 | 
						|
 | 
						|
# Reboot the system
 | 
						|
echo "Installation complete. Rebooting..."
 | 
						|
reboot |