From dba349a539be05fc1dc7790b24c64b0c1f249afc Mon Sep 17 00:00:00 2001 From: Bernardo Magri Date: Thu, 11 Jun 2026 08:51:30 +0100 Subject: [PATCH] fix(install): substitute from the live daemon store during the target build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- pkgs/nomarchy-install/nomarchy-install.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pkgs/nomarchy-install/nomarchy-install.sh b/pkgs/nomarchy-install/nomarchy-install.sh index ecab1ec..96ecb72 100644 --- a/pkgs/nomarchy-install/nomarchy-install.sh +++ b/pkgs/nomarchy-install/nomarchy-install.sh @@ -70,10 +70,14 @@ export NIX_CONFIG="flake-registry = $SHARE/registry.json" # With no network, every substituter query is a DNS timeout + retry storm # (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/null; then - info "No network — disabling binary caches (the ISO carries everything)." - NIX_CONFIG+=$'\nsubstituters =\nbuilders =' + info "No network — substituting from the ISO store only." + NIX_CONFIG+=$'\nsubstituters =\nextra-substituters = daemon?trusted=1\nbuilders =' fi # ─── Disk selection ───────────────────────────────────────────────────── @@ -439,7 +443,8 @@ set -e export PATH=/run/current-system/sw/bin:\$PATH export NIX_CONFIG=$(printf '%q' "$NIX_CONFIG") 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") 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