fix(install): offline installs copy the ISO store into the target up front

Substituter plumbing through nixos-install proved unreliable (env config
is overridden by its hardcoded flags; the forwarded --substituters flag
still left the plan building gcc from source). Make every ISO path valid
in the target store with one nix copy --all before nixos-install — the
in-target build then resolves everything locally and only the per-machine
config drvs are built.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Bernardo Magri
2026-06-11 10:01:49 +01:00
parent 77dba7ca5d
commit 29818d2fb6

View File

@@ -437,6 +437,18 @@ else
warn "flake archive failed — first rebuild will need network." warn "flake archive failed — first rebuild will need network."
fi fi
# Offline: sidestep substituter plumbing entirely — make every ISO store
# path valid in the target store up front. nixos-install's in-target
# build then finds all build tools locally and only the per-machine
# config derivations are built. (Two earlier attempts to route this
# through substituters — env config and the forwarded --substituters
# flag — still left the plan building gcc from source.)
if [[ ${#NIXOS_INSTALL_OPTS[@]} -gt 0 ]]; then
info "Copying the ISO store into the target (offline install)..."
nix --extra-experimental-features nix-command \
copy --all --no-check-sigs --to "local?root=/mnt"
fi
nixos-install --no-root-passwd "${NIXOS_INSTALL_OPTS[@]}" --flake "$FLAKE_DIR#default" nixos-install --no-root-passwd "${NIXOS_INSTALL_OPTS[@]}" --flake "$FLAKE_DIR#default"
success "System installed (bootloader in place)" success "System installed (bootloader in place)"