hosts/Infini-STICK: add install script

This commit is contained in:
Infinidoge 2021-12-10 09:39:19 -05:00
parent 9cc93918a9
commit 8df4f8c2c7
3 changed files with 45 additions and 3 deletions

35
hosts/Infini-STICK/install.bash Executable file
View file

@ -0,0 +1,35 @@
#!/usr/bin/env bash
# [[file:readme.org::install][install]]
# [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::mount][mount]]][mount]]
# [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::boilerplate][boilerplate]]][boilerplate]]
DISK=$1
sudo mkdir -p /mnt
if mountpoint -q -- "/mnt"; then
echo "ERROR: /mnt is a mounted filesystem, aborting"
exit 1
fi
# 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
# mount 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
# install ends here

View file

@ -40,9 +40,7 @@ Setup with a wide array of hardware compatibility, specifically using the =porta
#+NAME: reinstall #+NAME: reinstall
#+BEGIN_SRC bash :tangle reinstall.bash :shebang "#!/usr/bin/env bash" :noweb yes :comments noweb #+BEGIN_SRC bash :tangle reinstall.bash :shebang "#!/usr/bin/env bash" :noweb yes :comments noweb
<<boilerplate>> <<mount>>
<<mounting>>
<<installing>> <<installing>>
@ -60,6 +58,13 @@ Setup with a wide array of hardware compatibility, specifically using the =porta
<<mounting>> <<mounting>>
#+END_SRC #+END_SRC
#+NAME: install
#+BEGIN_SRC bash :tangle install.bash :shebang "#!/usr/bin/env bash" :noweb yes :comments noweb
<<mount>>
<<installing>>
#+END_SRC
** Script Boilerplate ** Script Boilerplate
#+NAME: boilerplate #+NAME: boilerplate

View file

@ -1,5 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# [[file:readme.org::reinstall][reinstall]] # [[file:readme.org::reinstall][reinstall]]
# [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::mount][mount]]][mount]]
# [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::boilerplate][boilerplate]]][boilerplate]] # [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::boilerplate][boilerplate]]][boilerplate]]
DISK=$1 DISK=$1
@ -25,6 +26,7 @@ echo "LOG: - Mounting EFI System Partition"
sudo mkdir -p /mnt/boot/efi sudo mkdir -p /mnt/boot/efi
sudo mount "${DISK}2" /mnt/boot/efi sudo mount "${DISK}2" /mnt/boot/efi
# mounting ends here # mounting ends here
# mount ends here
# [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::installing][installing]]][installing]] # [[[[file:/etc/nixos/hosts/Infini-STICK/readme.org::installing][installing]]][installing]]
echo "LOG: Installing NixOS" echo "LOG: Installing NixOS"