fix(install): root-side flake refs must be path:, not git+file
The chown fix made the flake user-owned, and root's libgit2 then refuses
git+file fetches of it ("not owned by current user") — which silently
killed the seeding step under set -e and would equally break
nixos-install --flake. Use path: refs for the live-side archive and the
nixos-install invocation (path flakes read flake.lock, skip libgit2),
and make seeding failure non-fatal as intended.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -425,15 +425,17 @@ section "Installing (this takes a while)"
|
||||
# `flake archive --to` enforces signatures and locally-evaluated source
|
||||
# paths have none; plain `nix copy` accepts --no-check-sigs.
|
||||
info "Seeding flake inputs into the target store..."
|
||||
# path: (not git+file) — the flake dir is owned by the target user and
|
||||
# root's libgit2 refuses repositories owned by someone else.
|
||||
flake_paths=$(nix --extra-experimental-features "nix-command flakes" \
|
||||
flake archive --json "$FLAKE_DIR" 2>/dev/null \
|
||||
flake archive --json "path:$FLAKE_DIR" \
|
||||
| python3 -c '
|
||||
import json, sys
|
||||
def walk(node):
|
||||
yield node["path"]
|
||||
for child in node.get("inputs", {}).values():
|
||||
yield from walk(child)
|
||||
print("\n".join(walk(json.load(sys.stdin))))')
|
||||
print("\n".join(walk(json.load(sys.stdin))))' || true)
|
||||
if [[ -n "$flake_paths" ]]; then
|
||||
# shellcheck disable=SC2086
|
||||
nix --extra-experimental-features "nix-command flakes" \
|
||||
@@ -455,7 +457,7 @@ if [[ ${#NIXOS_INSTALL_OPTS[@]} -gt 0 ]]; then
|
||||
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 "path:$FLAKE_DIR#default"
|
||||
success "System installed (bootloader in place)"
|
||||
|
||||
# Pre-activate the Home Manager generation so the FIRST boot lands in the
|
||||
|
||||
Reference in New Issue
Block a user