hosts/Infini-SERVER: create setup script
This commit is contained in:
parent
50004096d4
commit
4c5762d450
5 changed files with 359 additions and 0 deletions
184
hosts/Infini-SERVER/readme.org
Normal file
184
hosts/Infini-SERVER/readme.org
Normal file
|
@ -0,0 +1,184 @@
|
|||
#+TITLE: Infini-SERVER Specification
|
||||
#+AUTHOR: Infinidoge
|
||||
#+OPTIONS: toc:nil
|
||||
#+LaTeX_CLASS_OPTIONS: [12pt]
|
||||
#+LATEX_HEADER: \usepackage[margin=1in]{geometry}
|
||||
|
||||
* Partition Scheme
|
||||
|
||||
| Position | Label | FS Type | Size | Type |
|
||||
|----------+-----------------+---------+------+----------------------|
|
||||
| 0 | =boot= | =vfat= | 511M | EFI System Partition |
|
||||
| 1 | =Infini-SERVER= | =btrfs= | Rest | Root Partition |
|
||||
|
||||
* Configuration
|
||||
|
||||
Setup for my main server hosting computer, using an Nvidia GPU and the =server= form factor from =hardware/form=.
|
||||
|
||||
* Setup Scripts
|
||||
|
||||
#+NAME: full_install
|
||||
#+BEGIN_SRC bash :tangle setup.bash :shebang "#!/usr/bin/env bash" :noweb yes :comments noweb
|
||||
<<boilerplate>>
|
||||
|
||||
<<mmount_check>>
|
||||
|
||||
<<partitioning>>
|
||||
|
||||
<<filesystems>>
|
||||
|
||||
<<subvolumes>>
|
||||
|
||||
<<mounting>>
|
||||
|
||||
<<installing>>
|
||||
|
||||
<<full_extra>>
|
||||
|
||||
<<finishing_setup>>
|
||||
|
||||
<<cleanup>>
|
||||
#+END_SRC
|
||||
|
||||
#+NAME: reinstall
|
||||
#+BEGIN_SRC bash :tangle reinstall.bash :shebang "#!/usr/bin/env bash" :noweb yes :comments noweb
|
||||
<<mount>>
|
||||
|
||||
<<installing>>
|
||||
|
||||
<<reinstall_extra>>
|
||||
|
||||
<<finishing_setup>>
|
||||
|
||||
<<cleanup>>
|
||||
#+END_SRC
|
||||
|
||||
#+NAME: mount
|
||||
#+BEGIN_SRC bash :tangle mount.bash :shebang "#!/usr/bin/env bash" :noweb yes :comments noweb
|
||||
<<boilerplate>>
|
||||
|
||||
<<mount_check>>
|
||||
|
||||
<<mounting>>
|
||||
#+END_SRC
|
||||
|
||||
#+NAME: install
|
||||
#+BEGIN_SRC bash :tangle install.bash :shebang "#!/usr/bin/env bash" :noweb yes :comments noweb
|
||||
<<installing>>
|
||||
#+END_SRC
|
||||
|
||||
** Script Boilerplate
|
||||
|
||||
#+NAME: boilerplate
|
||||
#+BEGIN_SRC bash
|
||||
DISK=$1
|
||||
|
||||
sudo mkdir -p /mnt
|
||||
#+END_SRC
|
||||
|
||||
#+NAME: mount_check
|
||||
#+BEGIN_SRC bash
|
||||
if mountpoint -q -- "/mnt"; then
|
||||
echo "ERROR: /mnt is a mounted filesystem, aborting"
|
||||
exit 1
|
||||
fi
|
||||
#+END_SRC
|
||||
|
||||
** Partitioning
|
||||
|
||||
#+NAME: partitioning
|
||||
#+BEGIN_SRC bash
|
||||
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
|
||||
#+END_SRC
|
||||
|
||||
** Making Filesystems
|
||||
|
||||
#+NAME: filesystems
|
||||
#+BEGIN_SRC bash
|
||||
echo "LOG: Making filesystems"
|
||||
echo "- Making fat32 filesystem on ${DISK}1"
|
||||
sudo mkfs.fat -F 32 -n boot "${DISK}1"
|
||||
echo "- Making btrfs filesystem on ${DISK}2"
|
||||
sudo mkfs.btrfs "${DISK}2" -L "Infini-SERVER" -f
|
||||
echo "- Making swap space on ${DISK}3"
|
||||
sudo mkswap -L swap "${DISK}3"
|
||||
#+END_SRC
|
||||
|
||||
** Making Subvolumes
|
||||
|
||||
#+NAME: subvolumes
|
||||
#+BEGIN_SRC bash
|
||||
echo "LOG: Making subvolumes on ${DISK}2"
|
||||
sudo mount "${DISK}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
|
||||
#+END_SRC
|
||||
|
||||
** Mounting Volumes
|
||||
|
||||
#+NAME: mounting
|
||||
#+BEGIN_SRC bash
|
||||
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}2" /mnt/persist
|
||||
sudo mount -o subvol=nix,autodefrag,noatime "${DISK}2" /mnt/nix
|
||||
sudo mount -o subvol=boot,autodefrag,noatime "${DISK}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 "${DISK}1" /mnt/boot/efi
|
||||
#+END_SRC
|
||||
|
||||
** Installing
|
||||
|
||||
#+NAME: installing
|
||||
#+BEGIN_SRC bash
|
||||
echo "LOG: Installing NixOS"
|
||||
sudo nixos-install --flake /etc/nixos#Infini-SERVER --no-root-password
|
||||
#+END_SRC
|
||||
|
||||
** Extra (Full Install)
|
||||
|
||||
#+NAME: full_extra
|
||||
#+BEGIN_SRC bash
|
||||
echo "LOG: Cloning configuration"
|
||||
sudo git clone --no-hardlinks --progress https://gitlab.com/infinidoge/devos.git /mnt/persist/etc/nixos
|
||||
#+END_SRC
|
||||
|
||||
** Extra (Reinstall)
|
||||
|
||||
#+NAME: reinstall_extra
|
||||
#+BEGIN_SRC bash
|
||||
#+END_SRC
|
||||
|
||||
** Finishing Setup
|
||||
|
||||
#+NAME: finishing_setup
|
||||
#+BEGIN_SRC bash
|
||||
#+END_SRC
|
||||
|
||||
** Cleanup
|
||||
|
||||
#+NAME: cleanup
|
||||
#+BEGIN_SRC bash
|
||||
echo "LOG: Unmounting all"
|
||||
sudo umount -R /mnt
|
||||
#+END_SRC
|
Loading…
Add table
Add a link
Reference in a new issue