fix(install): stage the pre-activation script in /root — nixos-enter tmpfs-mounts /tmp
The HM pre-activation never ran: the script was written to /mnt/tmp and nixos-enter mounts a fresh tmpfs over /tmp inside the chroot, so `bash /tmp/...` found nothing and the best-effort guard swallowed it. Verified interactively that every inner step (path: build as root, runuser leg) works in the chroot — only the staging path was broken. Now staged in /root, with set -x logging persisted to /var/log/nomarchy-hm-preactivate.log on the target and the tail echoed into the install transcript on failure. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -464,10 +464,13 @@ success "System installed (bootloader in place)"
|
|||||||
# fully themed desktop, not bare Hyprland. Best-effort: a failure here
|
# fully themed desktop, not bare Hyprland. Best-effort: a failure here
|
||||||
# only costs the user one `home-manager switch` after logging in.
|
# only costs the user one `home-manager switch` after logging in.
|
||||||
section "Baking the desktop"
|
section "Baking the desktop"
|
||||||
cat > /mnt/tmp/nomarchy-hm-activate.sh <<EOF
|
# NOT /mnt/tmp: nixos-enter mounts a fresh tmpfs over /tmp inside the
|
||||||
set -e
|
# chroot, which silently vaporizes any script staged there (cost us a
|
||||||
|
# full verification round to find). /root persists into the chroot.
|
||||||
|
cat > /mnt/root/nomarchy-hm-activate.sh <<EOF
|
||||||
|
set -ex
|
||||||
|
exec > /var/log/nomarchy-hm-preactivate.log 2>&1
|
||||||
export PATH=/run/current-system/sw/bin:\$PATH
|
export PATH=/run/current-system/sw/bin:\$PATH
|
||||||
export NIX_CONFIG=$(printf '%q' "$NIX_CONFIG")
|
|
||||||
out=\$(nix --extra-experimental-features "nix-command flakes" \
|
out=\$(nix --extra-experimental-features "nix-command flakes" \
|
||||||
build --no-link --print-out-paths \
|
build --no-link --print-out-paths \
|
||||||
--option substituters "" \
|
--option substituters "" \
|
||||||
@@ -476,13 +479,15 @@ install -d -o "$USERNAME" -g users /nix/var/nix/profiles/per-user/$USERNAME
|
|||||||
install -d -o "$USERNAME" -g users /nix/var/nix/gcroots/per-user/$USERNAME
|
install -d -o "$USERNAME" -g users /nix/var/nix/gcroots/per-user/$USERNAME
|
||||||
runuser -u "$USERNAME" -- bash -lc "USER=$USERNAME HOME=/home/$USERNAME \$out/activate"
|
runuser -u "$USERNAME" -- bash -lc "USER=$USERNAME HOME=/home/$USERNAME \$out/activate"
|
||||||
EOF
|
EOF
|
||||||
if nixos-enter --root /mnt -- bash /tmp/nomarchy-hm-activate.sh; then
|
if nixos-enter --root /mnt -- bash /root/nomarchy-hm-activate.sh; then
|
||||||
success "Desktop pre-activated — first boot is fully themed"
|
success "Desktop pre-activated — first boot is fully themed"
|
||||||
else
|
else
|
||||||
warn "Desktop pre-activation failed; after first login run:"
|
warn "Desktop pre-activation failed (see /var/log/nomarchy-hm-preactivate.log"
|
||||||
|
warn "on the installed system); after first login run:"
|
||||||
warn " home-manager switch --flake ~/.nomarchy -b bak"
|
warn " home-manager switch --flake ~/.nomarchy -b bak"
|
||||||
|
tail -n 5 /mnt/var/log/nomarchy-hm-preactivate.log 2>/dev/null || true
|
||||||
fi
|
fi
|
||||||
rm -f /mnt/tmp/nomarchy-hm-activate.sh
|
rm -f /mnt/root/nomarchy-hm-activate.sh
|
||||||
|
|
||||||
header "Nomarchy installed on $TARGET_DISK" \
|
header "Nomarchy installed on $TARGET_DISK" \
|
||||||
"User: $USERNAME @ $HOSTNAME_" \
|
"User: $USERNAME @ $HOSTNAME_" \
|
||||||
|
|||||||
Reference in New Issue
Block a user