hosts/Infini-SERVER: update script
This commit is contained in:
parent
4c5762d450
commit
2a6651fd67
6 changed files with 117 additions and 171 deletions
7
hosts/Infini-SERVER/bare_install.bash
Executable file
7
hosts/Infini-SERVER/bare_install.bash
Executable file
|
@ -0,0 +1,7 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
# [[file:readme.org::bare_install][bare_install]]
|
||||||
|
# [[[[file:/etc/nixos/hosts/Infini-SERVER/readme.org::installing][installing]]][installing]]
|
||||||
|
echo "LOG: Installing NixOS"
|
||||||
|
sudo nixos-install --flake /etc/nixos#Infini-SERVER --no-root-password
|
||||||
|
# installing ends here
|
||||||
|
# bare_install ends here
|
|
@ -1,7 +1,56 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# [[file:readme.org::install][install]]
|
# [[file:readme.org::install][install]]
|
||||||
|
# [[[[file:/etc/nixos/hosts/Infini-SERVER/readme.org::mount][mount]]][mount]]
|
||||||
|
# [[[[file:/etc/nixos/hosts/Infini-SERVER/readme.org::boilerplate][boilerplate]]][boilerplate]]
|
||||||
|
DISK=$1
|
||||||
|
|
||||||
|
sudo mkdir -p /mnt
|
||||||
|
# boilerplate ends here
|
||||||
|
|
||||||
|
# [[[[file:/etc/nixos/hosts/Infini-SERVER/readme.org::mount_check][mount_check]]][mount_check]]
|
||||||
|
if mountpoint -q -- "/mnt"; then
|
||||||
|
echo "ERROR: /mnt is a mounted filesystem, aborting"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
# mount_check ends here
|
||||||
|
|
||||||
|
# [[[[file:/etc/nixos/hosts/Infini-SERVER/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}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
|
||||||
|
# mounting ends here
|
||||||
|
# mount ends here
|
||||||
|
|
||||||
# [[[[file:/etc/nixos/hosts/Infini-SERVER/readme.org::installing][installing]]][installing]]
|
# [[[[file:/etc/nixos/hosts/Infini-SERVER/readme.org::installing][installing]]][installing]]
|
||||||
echo "LOG: Installing NixOS"
|
echo "LOG: Installing NixOS"
|
||||||
sudo nixos-install --flake /etc/nixos#Infini-SERVER --no-root-password
|
sudo nixos-install --flake /etc/nixos#Infini-SERVER --no-root-password
|
||||||
# installing ends here
|
# installing ends here
|
||||||
|
|
||||||
|
# [[[[file:/etc/nixos/hosts/Infini-SERVER/readme.org::install_extra][install_extra]]][install_extra]]
|
||||||
|
echo "LOG: Cloning configuration"
|
||||||
|
sudo chown -R infinidoge /mnt/persist/etc/nixos
|
||||||
|
git clone --no-hardlinks --progress https://gitlab.com/infinidoge/devos.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
|
||||||
|
# install_extra ends here
|
||||||
|
|
||||||
|
# [[[[file:/etc/nixos/hosts/Infini-SERVER/readme.org::cleanup][cleanup]]][cleanup]]
|
||||||
|
echo "LOG: Unmounting all"
|
||||||
|
sudo umount -R /mnt
|
||||||
|
# cleanup ends here
|
||||||
# install ends here
|
# install ends here
|
||||||
|
|
42
hosts/Infini-SERVER/prep.bash
Executable file
42
hosts/Infini-SERVER/prep.bash
Executable file
|
@ -0,0 +1,42 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
# [[file:readme.org::preparation][preparation]]
|
||||||
|
# [[[[file:/etc/nixos/hosts/Infini-SERVER/readme.org::boilerplate][boilerplate]]][boilerplate]]
|
||||||
|
DISK=$1
|
||||||
|
|
||||||
|
sudo mkdir -p /mnt
|
||||||
|
# boilerplate ends here
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [[[[file:/etc/nixos/hosts/Infini-SERVER/readme.org::partitioning][partitioning]]][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
|
||||||
|
# partitioning ends here
|
||||||
|
|
||||||
|
# [[[[file:/etc/nixos/hosts/Infini-SERVER/readme.org::filesystems][filesystems]]][filesystems]]
|
||||||
|
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"
|
||||||
|
# filesystems ends here
|
||||||
|
|
||||||
|
# [[[[file:/etc/nixos/hosts/Infini-SERVER/readme.org::subvolumes][subvolumes]]][subvolumes]]
|
||||||
|
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
|
||||||
|
# subvolumes ends here
|
||||||
|
# preparation ends here
|
|
@ -6,10 +6,11 @@
|
||||||
|
|
||||||
* Partition Scheme
|
* Partition Scheme
|
||||||
|
|
||||||
| Position | Label | FS Type | Size | Type |
|
| Position | Label | FS Type | Size | Type |
|
||||||
|----------+-----------------+---------+------+----------------------|
|
|----------+-----------------+------------------+------+----------------------|
|
||||||
| 0 | =boot= | =vfat= | 511M | EFI System Partition |
|
| 1 | =boot= | =vfat= / =fat32= | 511M | EFI System Partition |
|
||||||
| 1 | =Infini-SERVER= | =btrfs= | Rest | Root Partition |
|
| 2 | =Infini-SERVER= | =btrfs= | Rest | Root Partition |
|
||||||
|
| 3 | =swap= | =swap= | 24G | Swap Space |
|
||||||
|
|
||||||
* Configuration
|
* Configuration
|
||||||
|
|
||||||
|
@ -17,8 +18,8 @@ Setup for my main server hosting computer, using an Nvidia GPU and the =server=
|
||||||
|
|
||||||
* Setup Scripts
|
* Setup Scripts
|
||||||
|
|
||||||
#+NAME: full_install
|
#+NAME: preparation
|
||||||
#+BEGIN_SRC bash :tangle setup.bash :shebang "#!/usr/bin/env bash" :noweb yes :comments noweb
|
#+BEGIN_SRC bash :tangle prep.bash :shebang "#!/usr/bin/env bash" :noweb yes :comments noweb
|
||||||
<<boilerplate>>
|
<<boilerplate>>
|
||||||
|
|
||||||
<<mmount_check>>
|
<<mmount_check>>
|
||||||
|
@ -28,27 +29,15 @@ Setup for my main server hosting computer, using an Nvidia GPU and the =server=
|
||||||
<<filesystems>>
|
<<filesystems>>
|
||||||
|
|
||||||
<<subvolumes>>
|
<<subvolumes>>
|
||||||
|
|
||||||
<<mounting>>
|
|
||||||
|
|
||||||
<<installing>>
|
|
||||||
|
|
||||||
<<full_extra>>
|
|
||||||
|
|
||||||
<<finishing_setup>>
|
|
||||||
|
|
||||||
<<cleanup>>
|
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
#+NAME: reinstall
|
#+NAME: install
|
||||||
#+BEGIN_SRC bash :tangle reinstall.bash :shebang "#!/usr/bin/env bash" :noweb yes :comments noweb
|
#+BEGIN_SRC bash :tangle install.bash :shebang "#!/usr/bin/env bash" :noweb yes :comments noweb
|
||||||
<<mount>>
|
<<mount>>
|
||||||
|
|
||||||
<<installing>>
|
<<installing>>
|
||||||
|
|
||||||
<<reinstall_extra>>
|
<<install_extra>>
|
||||||
|
|
||||||
<<finishing_setup>>
|
|
||||||
|
|
||||||
<<cleanup>>
|
<<cleanup>>
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
@ -62,8 +51,8 @@ Setup for my main server hosting computer, using an Nvidia GPU and the =server=
|
||||||
<<mounting>>
|
<<mounting>>
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
#+NAME: install
|
#+NAME: bare_install
|
||||||
#+BEGIN_SRC bash :tangle install.bash :shebang "#!/usr/bin/env bash" :noweb yes :comments noweb
|
#+BEGIN_SRC bash :tangle bare_install.bash :shebang "#!/usr/bin/env bash" :noweb yes :comments noweb
|
||||||
<<installing>>
|
<<installing>>
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
|
@ -155,24 +144,17 @@ echo "LOG: Installing NixOS"
|
||||||
sudo nixos-install --flake /etc/nixos#Infini-SERVER --no-root-password
|
sudo nixos-install --flake /etc/nixos#Infini-SERVER --no-root-password
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
** Extra (Full Install)
|
** Extra (Install)
|
||||||
|
|
||||||
#+NAME: full_extra
|
#+NAME: install_extra
|
||||||
#+BEGIN_SRC bash
|
#+BEGIN_SRC bash
|
||||||
echo "LOG: Cloning configuration"
|
echo "LOG: Cloning configuration"
|
||||||
sudo git clone --no-hardlinks --progress https://gitlab.com/infinidoge/devos.git /mnt/persist/etc/nixos
|
sudo chown -R infinidoge /mnt/persist/etc/nixos
|
||||||
#+END_SRC
|
git clone --no-hardlinks --progress https://gitlab.com/infinidoge/devos.git /mnt/persist/etc/nixos
|
||||||
|
|
||||||
** Extra (Reinstall)
|
echo "LOG: Installing Doom Emacs"
|
||||||
|
git clone --no-hardlinks --progress --depth 1 https://github.com/hlissner/doom-emacs /mnt/persist/home/infinidoge/.config/emacs
|
||||||
#+NAME: reinstall_extra
|
HOME=/mnt/persist/home/infinidoge /mnt/persist/home/infinidoge/.config/emacs/bin/doom -y install --no-config
|
||||||
#+BEGIN_SRC bash
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
** Finishing Setup
|
|
||||||
|
|
||||||
#+NAME: finishing_setup
|
|
||||||
#+BEGIN_SRC bash
|
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
** Cleanup
|
** Cleanup
|
||||||
|
|
|
@ -1,54 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
# [[file:readme.org::reinstall][reinstall]]
|
|
||||||
# [[[[file:/etc/nixos/hosts/Infini-SERVER/readme.org::mount][mount]]][mount]]
|
|
||||||
# [[[[file:/etc/nixos/hosts/Infini-SERVER/readme.org::boilerplate][boilerplate]]][boilerplate]]
|
|
||||||
DISK=$1
|
|
||||||
|
|
||||||
sudo mkdir -p /mnt
|
|
||||||
# boilerplate ends here
|
|
||||||
|
|
||||||
# [[[[file:/etc/nixos/hosts/Infini-SERVER/readme.org::mount_check][mount_check]]][mount_check]]
|
|
||||||
if mountpoint -q -- "/mnt"; then
|
|
||||||
echo "ERROR: /mnt is a mounted filesystem, aborting"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
# mount_check ends here
|
|
||||||
|
|
||||||
# [[[[file:/etc/nixos/hosts/Infini-SERVER/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}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
|
|
||||||
# mounting ends here
|
|
||||||
# mount ends here
|
|
||||||
|
|
||||||
# [[[[file:/etc/nixos/hosts/Infini-SERVER/readme.org::installing][installing]]][installing]]
|
|
||||||
echo "LOG: Installing NixOS"
|
|
||||||
sudo nixos-install --flake /etc/nixos#Infini-SERVER --no-root-password
|
|
||||||
# installing ends here
|
|
||||||
|
|
||||||
# [[[[file:/etc/nixos/hosts/Infini-SERVER/readme.org::reinstall_extra][reinstall_extra]]][reinstall_extra]]
|
|
||||||
|
|
||||||
# reinstall_extra ends here
|
|
||||||
|
|
||||||
# [[[[file:/etc/nixos/hosts/Infini-SERVER/readme.org::finishing_setup][finishing_setup]]][finishing_setup]]
|
|
||||||
|
|
||||||
# finishing_setup ends here
|
|
||||||
|
|
||||||
# [[[[file:/etc/nixos/hosts/Infini-SERVER/readme.org::cleanup][cleanup]]][cleanup]]
|
|
||||||
echo "LOG: Unmounting all"
|
|
||||||
sudo umount -R /mnt
|
|
||||||
# cleanup ends here
|
|
||||||
# reinstall ends here
|
|
|
@ -1,80 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
# [[file:readme.org::full_install][full_install]]
|
|
||||||
# [[[[file:/etc/nixos/hosts/Infini-SERVER/readme.org::boilerplate][boilerplate]]][boilerplate]]
|
|
||||||
DISK=$1
|
|
||||||
|
|
||||||
sudo mkdir -p /mnt
|
|
||||||
# boilerplate ends here
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [[[[file:/etc/nixos/hosts/Infini-SERVER/readme.org::partitioning][partitioning]]][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
|
|
||||||
# partitioning ends here
|
|
||||||
|
|
||||||
# [[[[file:/etc/nixos/hosts/Infini-SERVER/readme.org::filesystems][filesystems]]][filesystems]]
|
|
||||||
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"
|
|
||||||
# filesystems ends here
|
|
||||||
|
|
||||||
# [[[[file:/etc/nixos/hosts/Infini-SERVER/readme.org::subvolumes][subvolumes]]][subvolumes]]
|
|
||||||
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
|
|
||||||
# subvolumes ends here
|
|
||||||
|
|
||||||
# [[[[file:/etc/nixos/hosts/Infini-SERVER/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}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
|
|
||||||
# mounting ends here
|
|
||||||
|
|
||||||
# [[[[file:/etc/nixos/hosts/Infini-SERVER/readme.org::installing][installing]]][installing]]
|
|
||||||
echo "LOG: Installing NixOS"
|
|
||||||
sudo nixos-install --flake /etc/nixos#Infini-SERVER --no-root-password
|
|
||||||
# installing ends here
|
|
||||||
|
|
||||||
# [[[[file:/etc/nixos/hosts/Infini-SERVER/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-SERVER/readme.org::finishing_setup][finishing_setup]]][finishing_setup]]
|
|
||||||
|
|
||||||
# finishing_setup ends here
|
|
||||||
|
|
||||||
# [[[[file:/etc/nixos/hosts/Infini-SERVER/readme.org::cleanup][cleanup]]][cleanup]]
|
|
||||||
echo "LOG: Unmounting all"
|
|
||||||
sudo umount -R /mnt
|
|
||||||
# cleanup ends here
|
|
||||||
# full_install ends here
|
|
Loading…
Add table
Add a link
Reference in a new issue