about summary refs log tree commit diff stats
path: root/bootstrap/01_install
diff options
context:
space:
mode:
authorSoispha <soispha@vhack.eu>2023-07-02 13:01:36 +0200
committerSoispha <soispha@vhack.eu>2023-07-10 16:44:20 +0200
commiteb6a837828134ef034a6ee9b0feec197c52f8bc7 (patch)
treeed4dc09af0182e058534866935974bfba3f6f5f4 /bootstrap/01_install
parentFix(system/disks): Add remainder about bootable option (diff)
downloadnixos-config-eb6a837828134ef034a6ee9b0feec197c52f8bc7.tar.gz
nixos-config-eb6a837828134ef034a6ee9b0feec197c52f8bc7.zip
Fix(bootstrap): Only set environment variables once
Diffstat (limited to 'bootstrap/01_install')
-rwxr-xr-xbootstrap/01_install40
1 files changed, 19 insertions, 21 deletions
diff --git a/bootstrap/01_install b/bootstrap/01_install
index 2c8fa108..f1d5cc6f 100755
--- a/bootstrap/01_install
+++ b/bootstrap/01_install
@@ -6,14 +6,14 @@ SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH
 INSTALL=y . %SCRIPT_ENSURE_CONFIG_VARIABLES
 
 msg "Important information:"
-msg2 "Choose disk id is: $NIX_DISK";
+msg2 "Choose disk id is: $NIX_DISK"
 warning "This information needs to be entered in the host configuration BEFORE rebuilding it. Otherwise you'll have to wait for a 1 h cooldown!"
-info_applied=false;
-while [ "$info_applied" = false ];do
+info_applied=false
+while [ "$info_applied" = false ]; do
     readp "Have you updated your chosen host with the choose disk id? [N/y]: " result
     case $result in
         [Yy])
-            info_applied=true;
+            info_applied=true
             ;;
         *)
             warning "You won't be able to boot, if you don't update it!"
@@ -22,24 +22,24 @@ while [ "$info_applied" = false ];do
 done
 
 msg "Started creating filesystem..."
-nix run github:nix-community/disko -- --flake "git+https://codeberg.org/soispha/nixos-config#$NIX_HOST" --mode disko --experimental-features 'nix-command flakes';
+nix run github:nix-community/disko -- --flake "git+https://codeberg.org/soispha/nixos-config#$NIX_HOST" --mode disko --experimental-features 'nix-command flakes'
 msg "Finished mounting and generating btrfs subvolumes"
 
 msg "Creating swapfile..."
-msg2 "$(btrfs filesystem mkswapfile --size "$(free -m | awk '{if (NR==2) {printf "%sm\n", $2 + 500}}')" /mnt/swap/swapfile)";
+msg2 "$(btrfs filesystem mkswapfile --size "$(free -m | awk '{if (NR==2) {printf "%sm\n", $2 + 500}}')" /mnt/swap/swapfile)"
 msg "Finished creating swapfile!"
 
 msg "Important information:"
-msg2 "Swapfile UUID is: $(findmnt -no UUID -T /mnt/swap/swapfile)";
-msg2 "Swapfile resume offset is: $(btrfs inspect-internal map-swapfile -r /mnt/swap/swapfile)";
+msg2 "Swapfile UUID is: $(findmnt -no UUID -T /mnt/swap/swapfile)"
+msg2 "Swapfile resume offset is: $(btrfs inspect-internal map-swapfile -r /mnt/swap/swapfile)"
 warning "This information needs to be entered in the host configuration BEFORE rebuilding it. Otherwise the system won't boot!"
 
-info_applied=false;
-while [ "$info_applied" = false ];do
+info_applied=false
+while [ "$info_applied" = false ]; do
     readp "Have you updated your chosen host with this information? [N/y]: " result
     case $result in
         [Yy])
-            info_applied=true;
+            info_applied=true
             ;;
         *)
             warning "You won't be able to boot, if you don't update it!"
@@ -48,36 +48,34 @@ while [ "$info_applied" = false ];do
 done
 
 msg "Checking for incompatibilities..."
-ssd_or_hdd="$(cat /sys/block/"$(basename "$(readlink -f "$NIX_DISK")" | tr -d '\n')"/queue/rotational)";
+ssd_or_hdd="$(cat /sys/block/"$(basename "$(readlink -f "$NIX_DISK")" | tr -d '\n')"/queue/rotational)"
 case "$ssd_or_hdd" in
     0)
         msg2 "You seem to use a ssd."
-        trim_support=$(lsblk --bytes --json --discard | jq --arg name "$disk" '.blockdevices | .[] | select(.name == $name) | (.["disc-gran"] + .["disc-max"]) != 0');
+        trim_support=$(lsblk --bytes --json --discard | jq --arg name "$disk" '.blockdevices | .[] | select(.name == $name) | (.["disc-gran"] + .["disc-max"]) != 0')
         case $trim_support in
             "true")
-                msg2 "Yay, your ssd supports trim, go on and activate it";
+                msg2 "Yay, your ssd supports trim, go on and activate it"
                 ;;
             "false")
-                msg2 "Nay, your ssd doesn't support trim";
+                msg2 "Nay, your ssd doesn't support trim"
                 ;;
             *)
-                warning "Your ssd doesn't seem to exists, if this bothers you please open an issue.'";
+                warning "Your ssd doesn't seem to exists, if this bothers you please open an issue.'"
                 ;;
         esac
         ;;
     1)
-        msg2 "You seem to use a hdd there is nothing you have to do";
+        msg2 "You seem to use a hdd there is nothing you have to do"
         ;;
     *)
         warning "There is no indicator, which shows, which drive your are using.\n This means, that you have to check yourself, which optimizations you should activate."
         ;;
 esac
 
-
 case "$INSTALL_TO_SETUP" in
     "yes")
-        nix run "git+https://codeberg.org/soispha/nixos-config#setup" --experimental-features 'nix-command flakes';
-        ;;
-    *)
+        nix run "git+https://codeberg.org/soispha/nixos-config#setup" --experimental-features 'nix-command flakes'
         ;;
+    *) ;;
 esac