fix(install): substitute from the live daemon store during the target build
nixos-install builds with --store /mnt and passes its own substituter as "auto?trusted=1", which in that context resolves to the target store itself — so nothing flowed from the ISO and nix fell back to a full-source bootstrap (gcc/python/bash tarball fetches → offline death). Host-store simulation (fresh local?root, substituters cleared) proves "daemon?trusted=1" makes the whole install substitute + build offline: 1125 paths copied, only the per-machine config drvs built locally. Also drop --offline from the chroot HM build (that flag disables ALL substituters; plain empty substituters does what we want without it). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -70,10 +70,14 @@ export NIX_CONFIG="flake-registry = $SHARE/registry.json"
|
|||||||
|
|
||||||
# With no network, every substituter query is a DNS timeout + retry storm
|
# With no network, every substituter query is a DNS timeout + retry storm
|
||||||
# (and tickles a nix goal.cc assertion crash). Everything an install needs
|
# (and tickles a nix goal.cc assertion crash). Everything an install needs
|
||||||
# is pinned into the ISO — drop substituters entirely when offline.
|
# is pinned into the ISO — drop the binary caches and substitute from the
|
||||||
|
# live store's daemon instead. The explicit daemon substituter matters:
|
||||||
|
# nixos-install builds with --store /mnt and its own "auto?trusted=1"
|
||||||
|
# substituter resolves to the TARGET store (i.e. itself), so without
|
||||||
|
# this nothing flows from the ISO and nix bootstraps gcc from source.
|
||||||
if ! timeout 3 bash -c '</dev/tcp/cache.nixos.org/443' 2>/dev/null; then
|
if ! timeout 3 bash -c '</dev/tcp/cache.nixos.org/443' 2>/dev/null; then
|
||||||
info "No network — disabling binary caches (the ISO carries everything)."
|
info "No network — substituting from the ISO store only."
|
||||||
NIX_CONFIG+=$'\nsubstituters =\nbuilders ='
|
NIX_CONFIG+=$'\nsubstituters =\nextra-substituters = daemon?trusted=1\nbuilders ='
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ─── Disk selection ─────────────────────────────────────────────────────
|
# ─── Disk selection ─────────────────────────────────────────────────────
|
||||||
@@ -439,7 +443,8 @@ set -e
|
|||||||
export PATH=/run/current-system/sw/bin:\$PATH
|
export PATH=/run/current-system/sw/bin:\$PATH
|
||||||
export NIX_CONFIG=$(printf '%q' "$NIX_CONFIG")
|
export NIX_CONFIG=$(printf '%q' "$NIX_CONFIG")
|
||||||
out=\$(nix --extra-experimental-features "nix-command flakes" \
|
out=\$(nix --extra-experimental-features "nix-command flakes" \
|
||||||
build --offline --no-link --print-out-paths \
|
build --no-link --print-out-paths \
|
||||||
|
--option substituters "" \
|
||||||
"/home/$USERNAME/.nomarchy#homeConfigurations.$USERNAME.activationPackage")
|
"/home/$USERNAME/.nomarchy#homeConfigurations.$USERNAME.activationPackage")
|
||||||
install -d -o "$USERNAME" -g users /nix/var/nix/profiles/per-user/$USERNAME
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user