My Nix configuration. Enter at your own risk.
0

Configure Feed

Select the types of activity you want to include in your feed.

bootstrap: Remove boot disk detection + QoL improvements

author
Isaac Corbrey
date (May 24, 2026, 6:42 PM -0400) commit 4657a35d parent c01ba3bf change-id tpooovlv
+4 -26
+1 -1
README.md
··· 20 20 From the NixOS installer ISO: 21 21 22 22 ```sh 23 - curl -fsSL https://tangled.org/isaaccorbrey.com/dotnix/raw/main/bootstrap.sh | sh 23 + curl -fsSL https://tangled.org/isaaccorbrey.com/dotnix/raw/main/bootstrap.sh | sudo sh 24 24 ``` 25 25 26 26 Prompts (via [gum]) for host (queried from the flake's `nixosConfigurations`),
+3 -25
bootstrap.sh
··· 11 11 # hardware-configuration.nix is fine — this script overwrites it. 12 12 # 13 13 # Usage: 14 - # curl -fsSL <raw-url>/bootstrap.sh | sh 14 + # curl -fsSL <raw-url>/bootstrap.sh | sudo sh 15 15 # 16 16 # Env overrides (skip the corresponding prompt): 17 17 # NIX_HOST=elysium NIX_USER=icorbrey REPO_URL=... ··· 176 176 177 177 if [ "$ret" -ne 0 ]; then 178 178 gum log --level error "$title (exit $ret)" 179 - sed 's/\r$//' "$log" 179 + sed 's/\r$//' "$log" | gum pager 180 180 rm -f "$log" 181 181 return "$ret" 182 182 fi ··· 401 401 esac 402 402 } 403 403 404 - detect_boot_disk() { 405 - # NixOS installer mounts the live ISO at /iso when booted from removable media. 406 - # Trace that back to the parent disk so we can flag it in the disk picker. 407 - local src parent 408 - src=$(findmnt -no SOURCE /iso 2>/dev/null) || return 0 409 - [ -n "$src" ] || return 0 410 - parent=$(lsblk -no PKNAME "$src" 2>/dev/null | head -1) || return 0 411 - [ -n "$parent" ] && echo "/dev/$parent" 412 - } 413 - 414 404 partition_disk() { 415 405 gum style --bold "Disk setup" 416 406 417 - local disk_line disk boot_disk part_prefix swap_gb swap_end boot_part swap_part root_part 418 - boot_disk=$(detect_boot_disk) 407 + local disk_line disk part_prefix swap_gb swap_end boot_part swap_part root_part 419 408 420 409 disk_line=$( 421 410 lsblk -d -n -p -o NAME,SIZE,MODEL,TYPE \ 422 - | awk -v boot="$boot_disk" '$NF=="disk" { 423 - sub(/[[:space:]]+disk$/, ""); 424 - if (boot != "" && $1 == boot) print $0 " ← booted from this"; 425 - else print; 426 - }' \ 427 411 | gum choose --header "Select the target disk (will be wiped):" 428 412 ) 429 413 disk=$(echo "$disk_line" | awk '{print $1}') 430 - 431 - if [ -n "$boot_disk" ] && [ "$disk" = "$boot_disk" ]; then 432 - gum style --foreground 196 --bold "$disk is the disk you booted from." 433 - gum confirm --default=false "Really wipe the installer media?" \ 434 - || { echo "Aborted."; exit 1; } 435 - fi 436 414 437 415 swap_gb=$(pick_swap_size) 438 416