about summary refs log tree commit diff stats
path: root/bootstrap/99_ensure_config_variables
diff options
context:
space:
mode:
Diffstat (limited to 'bootstrap/99_ensure_config_variables')
-rwxr-xr-xbootstrap/99_ensure_config_variables41
1 files changed, 37 insertions, 4 deletions
diff --git a/bootstrap/99_ensure_config_variables b/bootstrap/99_ensure_config_variables
index 6758b221..89961150 100755
--- a/bootstrap/99_ensure_config_variables
+++ b/bootstrap/99_ensure_config_variables
@@ -1,13 +1,12 @@
 #! /usr/bin/env dash
 
 # shellcheck source=/dev/null
-#SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH
-SHELL_LIBRARY_VERSION="1.1.4" . /nix/store/m5vww39n11768whvhww00zrgkd3ry0q9-shell_library-v1.1.4/include/lib.sh
+SHELL_LIBRARY_VERSION="1.1.4" . %SHELL_LIBRARY_PATH
 
 if ! [ "$NIX_HOST" ]; then
     msg "Select a host:"
     _hosts=$(mktmp)
-    curl https://codeberg.org/soispha/nixos-config/raw/branch/prime/flake/nixosConfigurations/default.nix 2> /dev/null | awk -F '"' '/hosts = /{for (i=2;i<NF;i+=2) {print $i}}' > "$_hosts"
+    curl https://codeberg.org/soispha/nixos-config/raw/branch/prime/flake/nixosConfigurations/default.nix 2>/dev/null | awk -F '"' '/hosts = /{for (i=2;i<NF;i+=2) {print $i}}' > "$_hosts"
 
     while ! grep "$host" "$_hosts" > /dev/null || [ "$(printf "%s" "$host" | wc -c)" -eq 0 ]; do
         i=1
@@ -62,7 +61,19 @@ if ! [ "$NIX_DISK" ] && [ "$NIX_INSTALL" ]; then
         [Yy])
             msg "Great, continuing..."
             _disk="$(jq '.item' "$_disk" | tr -d "\"")"
-            export NIX_DISK="$_disk"
+            _disk_serial="$(udevadm info --query=all --name="$_disk" | grep ID_SERIAL= | awk 'BEGIN{FS="="}{print $2}')";
+            case "$_disk" in
+                "nvme*")
+                    _nix_disk="nvme-$_disk_serial";
+                    ;;
+                "sd*")
+                    _nix_disk="ata-$_disk_serial";
+                    ;;
+                *)
+                    die "Disk with name '$_disk' and serial '$_disk_serial' not yet supported!"
+                    ;;
+            esac
+            export NIX_DISK="$_nix_disk"
             ;;
         *)
             msg "Sure, keep your data"
@@ -82,5 +93,27 @@ if ! [ "$ACTIVATE_TO_SETUP" ] && ! [ "$INSTALL" ]; then
             ;;
     esac
 fi
+if ! [ "$INSTALL_TO_SETUP" ] && [ "$INSTALL" ]; then
+    readp "Do you want to continue with nixos-install after disk formatting? [N/y]: " result
+    case $result in
+        [Yy])
+            export INSTALL_TO_SETUP=yes;
+            ;;
+        *)
+            export INSTALL_TO_SETUP=no;
+            ;;
+    esac
+fi
+if ! [ "$SETUP_TO_CONFIG_SETUP" ]; then
+    readp "Do you want to continue with the user configuration setup after setup? [N/y]: " result;
+    case $result in
+        [Yy])
+            export SETUP_TO_CONFIG_SETUP=yes;
+            ;;
+        *)
+            export SETUP_TO_CONFIG_SETUP=no;
+            ;;
+    esac
+fi
 
 # vim: ft=sh