universe/hosts/Infini-SERVER
Infinidoge b76bc08d6d fix(Infini-SERVER): disable apcupsd
Shutting down my desktop would likely cause apcupsd on the server to
freak out, and possibly shut down the computer on its own.
I'll likely reconfigure the setup to have Infini-SERVER be the primary
connection to the UPS, with the desktop acting as the secondary, as
Infini-SERVER is online all of the time where possible.
2023-03-31 11:59:36 -04:00
..
bare_install.bash hosts/Infini-SERVER: update script 2023-03-30 12:29:47 -04:00
data_setup.bash refactor(setup): improve handling of partition prefix 2023-03-30 12:29:48 -04:00
default.nix fix(Infini-SERVER): disable apcupsd 2023-03-31 11:59:36 -04:00
hardware-configuration.nix refactor(form): set default into for servers 2023-03-30 12:29:48 -04:00
install.bash refactor(setup): improve handling of partition prefix 2023-03-30 12:29:48 -04:00
mount.bash refactor(setup): improve handling of partition prefix 2023-03-30 12:29:48 -04:00
prep.bash typo(setup): mmount -> mount 2023-03-30 12:29:48 -04:00
readme.org typo(setup): mmount -> mount 2023-03-30 12:29:48 -04:00

Infini-SERVER Setup

Partition Scheme

Position Label FS Type Size Type
1 boot vfat / fat32 511M EFI System Partition
2 Infini-SERVER btrfs Rest Root Partition
3 swap swap 24G Swap Space

Configuration

Setup for my main server hosting computer, using an Nvidia GPU and the server form factor from hardware/form.

Setup Scripts

<<boilerplate>>

<<mount_check>>

<<partitioning>>

<<filesystems>>

<<subvolumes>>
<<mount>>

<<installing>>

<<install_extra>>

<<cleanup>>
<<boilerplate>>

<<mount_check>>

<<mounting>>
<<installing>>
<<boilerplate>>

<<mount_check>>

<<data_partitioning>>

<<data_filesystems>>

<<data_subvolumes>>

Script Boilerplate

DISK=$1
PART=$DISK$2

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 ESP fat32 1MiB 512MiB
sudo parted $DISK -s -- mkpart primary btrfs 512MiB -24GiB
sudo parted $DISK -s -- mkpart primary linux-swap -24GiB 100%
sudo parted $DISK -s -- set 1 esp on

Making Filesystems

echo "LOG: Making filesystems"
echo "- Making fat32 filesystem on ${PART}1"
sudo mkfs.fat -F 32 -n boot "${PART}1"
echo "- Making btrfs filesystem on ${PART}2"
sudo mkfs.btrfs "${PART}2" -L "Infini-SERVER" -f
echo "- Making swap space on ${PART}3"
sudo mkswap -L swap "${PART}3"

Making Subvolumes

echo "LOG: Making subvolumes on ${PART}2"
sudo mount "${PART}2" /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 "${PART}2" /mnt/persist
sudo mount -o subvol=nix,autodefrag,noatime "${PART}2" /mnt/nix
sudo mount -o subvol=boot,autodefrag,noatime "${PART}2" /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 "${PART}1" /mnt/boot/efi

Installing

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

Extra (Install)

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

echo "LOG: Installing Doom Emacs"
git clone --no-hardlinks --progress --depth 1 https://github.com/hlissner/doom-emacs /mnt/persist/home/infinidoge/.config/emacs
HOME=/mnt/persist/home/infinidoge /mnt/persist/home/infinidoge/.config/emacs/bin/doom -y install --no-config

Cleanup

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

Setup Data Drive

Partitioning

echo "LOG: Partitioning $DISK for data storage"
sudo parted $DISK -- mktable gpt
sudo parted $DISK -s -- mkpart primary btrfs 0% 100%

Making Filesystems

echo "LOG: Making data filesystems"
echo "- Making btrfa filesystem on ${PART}1"
sudo mkfs.btrfs "${PART}1" --csum xxhash -L "data" -f

Making Subvolumes

echo "LOG: Making data subvolumes on ${PART}1"
sudo mount "${PART}1" /mnt
sudo btrfs subvolume create /mnt/root
sudo btrfs subvolume create /mnt/root/srv
sudo btrfs subvolume create /mnt/root/srv/minecraft
sudo btrfs subvolume create /mnt/root/srv/soft-serve

Setup Backup Drive

Partitioning

echo "LOG: Partitioning $DISK for backup storage"
sudo parted $DISK -- mktable gpt
sudo parted $DISK -s -- mkpart primary btrfs 0% 100%

Making Filesystems

echo "LOG: Making backup filesystems"
echo "- Making btrfa filesystem on ${PART}1"
sudo mkfs.btrfs "${PART}1" --csum xxhash -L "backup"