diff --git a/installer/disko-config.nix b/installer/disko-config.nix index eb183a0..bcab696 100644 --- a/installer/disko-config.nix +++ b/installer/disko-config.nix @@ -44,8 +44,8 @@ let content = { type = "luks"; name = extraLuks drive; + passwordFile = "/dev/shm/nomarchy-luks.key"; settings.allowDiscards = true; - settings.passwordFile = "/dev/shm/nomarchy-luks.key"; content.type = "btrfs"; }; }; @@ -116,8 +116,8 @@ in { content = { type = "luks"; name = mainLuksName; + passwordFile = "/dev/shm/nomarchy-luks.key"; settings.allowDiscards = true; - settings.passwordFile = "/dev/shm/nomarchy-luks.key"; content = rootBtrfs; }; }; diff --git a/installer/install.sh b/installer/install.sh index efb517c..0699904 100755 --- a/installer/install.sh +++ b/installer/install.sh @@ -869,17 +869,27 @@ configure_impermanence() { info "This provides a clean, reproducible system." echo "" - rc=0 - gum confirm "Enable Impermanence?" || rc=$? - if [[ $rc -eq 0 ]]; then - ENABLE_IMPERMANENCE="true" - success "Impermanence enabled" - else - if [[ $rc -eq 130 ]]; then return 130; fi - ENABLE_IMPERMANENCE="false" - info "Impermanence disabled (traditional persistent root)" - fi + local rc=0 + nrun gum confirm "Enable Impermanence?" || rc=$? + case "$rc" in + 0) + ENABLE_IMPERMANENCE="true" + success "Impermanence enabled" + ;; + 1) + ENABLE_IMPERMANENCE="false" + info "Impermanence disabled (traditional persistent root)" + ;; + 130) + return 130 + ;; + *) + ENABLE_IMPERMANENCE="false" + info "Impermanence disabled (traditional persistent root)" + ;; + esac save_state + return 0 } # ============================================================================ @@ -1084,6 +1094,10 @@ _LUKS_KEY_PATH="/dev/shm/nomarchy-luks.key" # Wrap the disko invocation so a failure surfaces the last few lines of # output and offers Retry / View full log / Abort. set -e is suspended for # the disko call so we can inspect its exit code; restored on every path. +# +# By default disko's chatty output is hidden behind a `gum spin` spinner; +# the full log is captured and shown on failure or via `gum pager`. Set +# NOMARCHY_VERBOSE_DISKO=1 to stream disko output live instead. run_disko_with_retry() { local main_drive="$1" local extras_nix="$2" @@ -1093,13 +1107,33 @@ run_disko_with_retry() { while true; do local rc=0 - set +e - disko --mode destroy,format,mount \ - --argstr mainDrive "$main_drive" \ - --arg extraDrives "$extras_nix" \ - "$disko_file" 2>&1 | tee "$log" - rc=${PIPESTATUS[0]} - set -e + if [[ "$NOMARCHY_VERBOSE_DISKO" == "1" ]]; then + set +e + disko --mode destroy,format,mount \ + --argstr mainDrive "$main_drive" \ + --arg extraDrives "$extras_nix" \ + "$disko_file" 2>&1 | tee "$log" + rc=${PIPESTATUS[0]} + set -e + else + # Silent path: run disko in the background, write all output to + # $log, and show a spinner. Use a status file for the exit code + # because `gum spin` doesn't propagate the wrapped command's rc. + local status_file + status_file=$(mktemp --suffix=.disko.rc) + set +e + nrun gum spin --spinner dot --title "Partitioning disk(s) with disko..." -- \ + bash -c ' + disko --mode destroy,format,mount \ + --argstr mainDrive "$1" \ + --arg extraDrives "$2" \ + "$3" > "$4" 2>&1 + echo $? > "$5" + ' _ "$main_drive" "$extras_nix" "$disko_file" "$log" "$status_file" + set -e + rc=$(cat "$status_file" 2>/dev/null || echo 1) + rm -f "$status_file" + fi if [[ $rc -eq 0 ]]; then rm -f "$log" @@ -1197,11 +1231,11 @@ execute_installation() { info "Initializing git repository..." ( cd /mnt/etc/nixos - nrun git git init -q - nrun git git add . - nrun git git config user.name "Nomarchy Installer" - nrun git git config user.email "installer@nomarchy" - nrun git git commit -qm "Initial Nomarchy configuration" + nrun git init -q + nrun git add . + nrun git config user.name "Nomarchy Installer" + nrun git config user.email "installer@nomarchy" + nrun git commit -qm "Initial Nomarchy configuration" ) success "Git repository initialized"