universe/hosts/Infini-STICK
2023-07-30 00:33:38 -04:00
..
default.nix hosts/*: remove unnecessary private import 2023-07-30 00:33:38 -04:00
hardware-configuration.nix feat(info): add info.model, fill in for hosts 2023-03-30 12:29:48 -04:00
install.bash hosts/Infini-STICK: separate mount_check in scripts 2023-03-30 12:29:47 -04:00
mount.bash hosts/Infini-STICK: bind persist home in script 2023-03-30 12:29:47 -04:00
readme.org typo(setup): mmount -> mount 2023-03-30 12:29:48 -04:00
reinstall.bash hosts/Infini-STICK: bind persist home in script 2023-03-30 12:29:47 -04:00
setup.bash typo(setup): mmount -> mount 2023-03-30 12:29:48 -04:00

Infini-STICK Setup

Partition Scheme

Position Label FS Type Size Type
0 Infini-STICK btrfs 29.3G Root Partition
1 boot vfat 511M EFI System Partition

Configuration

Setup with a wide array of hardware compatibility, specifically using the portable form defined in the hardware/form module.

Setup Scripts

<<boilerplate>>

<<mount_check>>

<<partitioning>>

<<filesystems>>

<<subvolumes>>

<<mounting>>

<<installing>>

<<full_extra>>

<<finishing_setup>>

<<cleanup>>
<<mount>>

<<installing>>

<<reinstall_extra>>

<<finishing_setup>>

<<cleanup>>
<<boilerplate>>

<<mount_check>>

<<mounting>>
<<installing>>

Script Boilerplate

DISK=$1

sudo mkdir -p /mnt
if mountpoint -q -- "/mnt"; then
    echo "ERROR: /mnt is a mounted filesystem, aborting"
    exit 1
fi

Partitioning

echo "LOG: Partitioning $DISK"
sudo parted $DISK -- mktable gpt
sudo parted $DISK -s -- mkpart primary btrfs 512MiB 100%
sudo parted $DISK -s -- mkpart ESP fat32 1MiB 512MiB
sudo parted $DISK -s -- set 2 esp on

Making Filesystems

echo "LOG: Making filesystems"
echo "- Making btrfs filesystem on ${DISK}1"
sudo mkfs.btrfs "${DISK}1" -L "Infini-STICK" -f
echo "- Making fat32 filesystem on ${DISK}2"
sudo mkfs.fat -F 32 -n boot "${DISK}2"

Making Subvolumes

echo "LOG: Making subvolumes on ${DISK}1"
sudo mount "${DISK}1" /mnt
sudo btrfs subvolume create /mnt/root
sudo btrfs subvolume create /mnt/root/home
sudo mkdir -p /mnt/root/etc
sudo btrfs subvolume create /mnt/root/etc/nixos
sudo btrfs subvolume create /mnt/boot
sudo btrfs subvolume create /mnt/nix
sudo btrfs subvolume create /mnt/nix/store
sudo umount /mnt

Mounting Volumes

echo "LOG: Mounting tmpfs"
sudo mount -t tmpfs root /mnt

echo "LOG: - Mounting persistent directories"
sudo mkdir -p /mnt/persist /mnt/nix /mnt/boot
sudo mount -o subvol=root,autodefrag,noatime "${DISK}1" /mnt/persist
sudo mount -o subvol=nix,autodefrag,noatime "${DISK}1" /mnt/nix
sudo mount -o subvol=boot,autodefrag,noatime "${DISK}1" /mnt/boot

echo "LOG: - - Mounting persistent subdirectories"
sudo mkdir -p /mnt/home
sudo mount --bind /mnt/persist/home /mnt/home

echo "LOG: - Mounting EFI System Partition"
sudo mkdir -p /mnt/boot/efi
sudo mount "${DISK}2" /mnt/boot/efi

Installing

echo "LOG: Installing NixOS"
sudo nixos-install --flake /etc/nixos#Infini-STICK --no-root-password

Extra (Full Install)

echo "LOG: Cloning configuration"
sudo git clone --no-hardlinks --progress https://gitlab.com/infinidoge/universe.git /mnt/persist/etc/nixos

Extra (Reinstall)

Finishing Setup

Cleanup

echo "LOG: Unmounting all"
sudo umount -R /mnt