fix(installer): repair git init, LUKS reprompt, impermanence-no exit, quiet disko
- nrun git git init -q passed 'git' as a subcommand to git itself, failing the post-disko repo init. Drop the duplicated arg. - disko's luks module reads passwordFile at the top level; placing it under settings.* meant it was silently ignored and disko fell back to askPassword=true, prompting the user again on luksOpen. Move the option to the right scope. - configure_impermanence now uses local rc, nrun gum confirm, and an explicit case (0/1/130) with a final return 0 so a No answer no longer aborts the installer. - run_disko_with_retry hides disko's chatty output behind a gum spin by default and surfaces the captured log on failure. Set NOMARCHY_VERBOSE_DISKO=1 to stream output live. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -44,8 +44,8 @@ let
|
|||||||
content = {
|
content = {
|
||||||
type = "luks";
|
type = "luks";
|
||||||
name = extraLuks drive;
|
name = extraLuks drive;
|
||||||
|
passwordFile = "/dev/shm/nomarchy-luks.key";
|
||||||
settings.allowDiscards = true;
|
settings.allowDiscards = true;
|
||||||
settings.passwordFile = "/dev/shm/nomarchy-luks.key";
|
|
||||||
content.type = "btrfs";
|
content.type = "btrfs";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -116,8 +116,8 @@ in {
|
|||||||
content = {
|
content = {
|
||||||
type = "luks";
|
type = "luks";
|
||||||
name = mainLuksName;
|
name = mainLuksName;
|
||||||
|
passwordFile = "/dev/shm/nomarchy-luks.key";
|
||||||
settings.allowDiscards = true;
|
settings.allowDiscards = true;
|
||||||
settings.passwordFile = "/dev/shm/nomarchy-luks.key";
|
|
||||||
content = rootBtrfs;
|
content = rootBtrfs;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -869,17 +869,27 @@ configure_impermanence() {
|
|||||||
info "This provides a clean, reproducible system."
|
info "This provides a clean, reproducible system."
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
rc=0
|
local rc=0
|
||||||
gum confirm "Enable Impermanence?" || rc=$?
|
nrun gum confirm "Enable Impermanence?" || rc=$?
|
||||||
if [[ $rc -eq 0 ]]; then
|
case "$rc" in
|
||||||
|
0)
|
||||||
ENABLE_IMPERMANENCE="true"
|
ENABLE_IMPERMANENCE="true"
|
||||||
success "Impermanence enabled"
|
success "Impermanence enabled"
|
||||||
else
|
;;
|
||||||
if [[ $rc -eq 130 ]]; then return 130; fi
|
1)
|
||||||
ENABLE_IMPERMANENCE="false"
|
ENABLE_IMPERMANENCE="false"
|
||||||
info "Impermanence disabled (traditional persistent root)"
|
info "Impermanence disabled (traditional persistent root)"
|
||||||
fi
|
;;
|
||||||
|
130)
|
||||||
|
return 130
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
ENABLE_IMPERMANENCE="false"
|
||||||
|
info "Impermanence disabled (traditional persistent root)"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
save_state
|
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
|
# 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
|
# 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.
|
# 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() {
|
run_disko_with_retry() {
|
||||||
local main_drive="$1"
|
local main_drive="$1"
|
||||||
local extras_nix="$2"
|
local extras_nix="$2"
|
||||||
@@ -1093,6 +1107,7 @@ run_disko_with_retry() {
|
|||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
local rc=0
|
local rc=0
|
||||||
|
if [[ "$NOMARCHY_VERBOSE_DISKO" == "1" ]]; then
|
||||||
set +e
|
set +e
|
||||||
disko --mode destroy,format,mount \
|
disko --mode destroy,format,mount \
|
||||||
--argstr mainDrive "$main_drive" \
|
--argstr mainDrive "$main_drive" \
|
||||||
@@ -1100,6 +1115,25 @@ run_disko_with_retry() {
|
|||||||
"$disko_file" 2>&1 | tee "$log"
|
"$disko_file" 2>&1 | tee "$log"
|
||||||
rc=${PIPESTATUS[0]}
|
rc=${PIPESTATUS[0]}
|
||||||
set -e
|
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
|
if [[ $rc -eq 0 ]]; then
|
||||||
rm -f "$log"
|
rm -f "$log"
|
||||||
@@ -1197,11 +1231,11 @@ execute_installation() {
|
|||||||
info "Initializing git repository..."
|
info "Initializing git repository..."
|
||||||
(
|
(
|
||||||
cd /mnt/etc/nixos
|
cd /mnt/etc/nixos
|
||||||
nrun git git init -q
|
nrun git init -q
|
||||||
nrun git git add .
|
nrun git add .
|
||||||
nrun git git config user.name "Nomarchy Installer"
|
nrun git config user.name "Nomarchy Installer"
|
||||||
nrun git git config user.email "installer@nomarchy"
|
nrun git config user.email "installer@nomarchy"
|
||||||
nrun git git commit -qm "Initial Nomarchy configuration"
|
nrun git commit -qm "Initial Nomarchy configuration"
|
||||||
)
|
)
|
||||||
success "Git repository initialized"
|
success "Git repository initialized"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user