hosts/Infini-STICK: separate install scripts

This commit is contained in:
Infinidoge 2021-12-09 13:45:21 -05:00
parent df3c87c6b0
commit 61fc46fed5
3 changed files with 121 additions and 14 deletions

View file

@ -17,8 +17,9 @@ Setup with a wide array of hardware compatibility, specifically using the =porta
* Setup Scripts
#+BEGIN_SRC bash :tangle setup.bash :tangle-mode :shebang "#!/usr/bin/env bash" :noweb yes
DISK=$1
#+NAME: full_install
#+BEGIN_SRC bash :tangle setup.bash :shebang "#!/usr/bin/env bash" :noweb yes :comments noweb
<<boilerplate>>
<<partitioning>>
@ -30,7 +31,35 @@ DISK=$1
<<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
<<boilerplate>>
<<mounting>>
<<installing>>
<<reinstall_extra>>
<<finishing_setup>>
<<cleanup>>
#+END_SRC
** Script Boilerplate
#+NAME: boilerplate
#+BEGIN_SRC bash
DISK=$1
sudo mkdir -p /mnt
#+END_SRC
** Partitioning
@ -59,8 +88,6 @@ sudo mkfs.fat -F 32 -n boot "${DISK}2"
#+NAME: subvolumes
#+BEGIN_SRC bash
sudo mkdir -p /mnt
echo "LOG: Making subvolumes on ${DISK}1"
sudo mount "${DISK}1" /mnt
sudo btrfs subvolume create /mnt/root
@ -95,17 +122,34 @@ sudo mount "${DISK}2" /mnt/boot/efi
#+NAME: installing
#+BEGIN_SRC bash
echo "LOG: Cloning configuration"
sudo git clone --no-hardlinks --progress /etc/nixos /mnt/persist/etc/nixos
echo "LOG: Installing NixOS"
sudo nixos-install --flake /mnt/persist/etc/nixos#Infini-STICK --no-root-password
sudo nixos-install --flake /etc/nixos#Infini-STICK --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

View file

@ -0,0 +1,41 @@
#!/usr/bin/env bash
# [[file:readme.org::reinstall][reinstall]]
# [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::boilerplate][boilerplate]]][boilerplate]]
DISK=$1
sudo mkdir -p /mnt
# boilerplate ends here
# [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::mounting][mounting]]][mounting]]
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 EFI System Partition"
sudo mkdir -p /mnt/boot/efi
sudo mount "${DISK}2" /mnt/boot/efi
# mounting ends here
# [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::installing][installing]]][installing]]
echo "LOG: Installing NixOS"
sudo nixos-install --flake /etc/nixos#Infini-STICK --no-root-password
# installing ends here
# [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::reinstall_extra][reinstall_extra]]][reinstall_extra]]
# reinstall_extra ends here
# [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::finishing_setup][finishing_setup]]][finishing_setup]]
# finishing_setup ends here
# [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::cleanup][cleanup]]][cleanup]]
echo "LOG: Unmounting all"
sudo umount -R /mnt
# cleanup ends here
# reinstall ends here

View file

@ -1,20 +1,28 @@
#!/usr/bin/env bash
# [[file:readme.org::full_install][full_install]]
# [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::boilerplate][boilerplate]]][boilerplate]]
DISK=$1
sudo mkdir -p /mnt
# boilerplate ends here
# [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::partitioning][partitioning]]][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
# partitioning ends here
# [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::filesystems][filesystems]]][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"
# filesystems ends here
sudo mkdir -p /mnt
# [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::subvolumes][subvolumes]]][subvolumes]]
echo "LOG: Making subvolumes on ${DISK}1"
sudo mount "${DISK}1" /mnt
sudo btrfs subvolume create /mnt/root
@ -25,7 +33,9 @@ sudo btrfs subvolume create /mnt/boot
sudo btrfs subvolume create /mnt/nix
sudo btrfs subvolume create /mnt/nix/store
sudo umount /mnt
# subvolumes ends here
# [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::mounting][mounting]]][mounting]]
echo "LOG: Mounting tmpfs"
sudo mount -t tmpfs root /mnt
@ -38,12 +48,24 @@ sudo mount -o subvol=boot,autodefrag,noatime "${DISK}1" /mnt/boot
echo "LOG: - Mounting EFI System Partition"
sudo mkdir -p /mnt/boot/efi
sudo mount "${DISK}2" /mnt/boot/efi
# mounting ends here
echo "LOG: Cloning configuration"
sudo git clone --no-hardlinks --progress /etc/nixos /mnt/persist/etc/nixos
# [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::installing][installing]]][installing]]
echo "LOG: Installing NixOS"
sudo nixos-install --flake /mnt/persist/etc/nixos#Infini-STICK --no-root-password
sudo nixos-install --flake /etc/nixos#Infini-STICK --no-root-password
# installing ends here
# [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::full_extra][full_extra]]][full_extra]]
echo "LOG: Cloning configuration"
sudo git clone --no-hardlinks --progress https://gitlab.com/infinidoge/devos.git /mnt/persist/etc/nixos
# full_extra ends here
# [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::finishing_setup][finishing_setup]]][finishing_setup]]
# finishing_setup ends here
# [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::cleanup][cleanup]]][cleanup]]
echo "LOG: Unmounting all"
sudo umount -R /mnt
# cleanup ends here
# full_install ends here