@@ -145,6 +145,8 @@ ok "Preflight passed ($(elapsed))"
145145
146146step 1 " Hardware configuration"
147147
148+ rm -f " ${HW_CONFIG} .tmp" # clean up any stale temp from a previous interrupted run
149+
148150if [[ -f " ${HW_CONFIG} " ]]; then
149151 ok " hardware-configuration.nix already present"
150152else
354356fi
355357
356358SIGNING_PUBKEY=$( grep -v ' ^untrusted comment' " ${MINISIGN_PUB} " | head -1)
359+ [[ -n " ${SIGNING_PUBKEY} " ]] || \
360+ die " minisign public key file is empty or malformed: ${MINISIGN_PUB}
361+ Delete and re-run: rm -f ${MINISIGN_PUB} ${MINISIGN_SEC} && sudo bash scripts/enroll.sh"
357362info " Signing public key: ${SIGNING_PUBKEY} "
358363
359364# Write nix-cache-info and sign it. nginx serves the .minisig file alongside
@@ -380,13 +385,14 @@ ok "enroll.nix written — no Nix file patching needed ($(elapsed))"
380385step 10 " Build NixOS closure + push to harmonia cache"
381386
382387info " Building builder-aarch64 system closure..."
388+ BUILD_LOG=" /tmp/sourceos-enroll-nix-build-$( date +%s) .log"
383389CLOSURE=$( nix build " ${REPO_ROOT} #nixosConfigurations.${HOST} .config.system.build.toplevel" \
384- --no-link --print-out-paths 2> /dev/null )
385- # nix build returns empty stdout on failure (errors go to stderr). Verify both that
386- # CLOSURE is non-empty and that the path actually exists in the Nix store .
390+ --no-link --print-out-paths 2> " ${BUILD_LOG} " )
391+ # nix build emits errors only to stderr (captured to BUILD_LOG above).
392+ # Verify stdout produced a non-empty, existing store path.
387393[[ -n " ${CLOSURE} " && -e " ${CLOSURE} " ]] || \
388- die " nix build failed — retry with:
389- nix build ${REPO_ROOT} #nixosConfigurations.${HOST} .config.system.build.toplevel --no-link --show-trace"
394+ die " nix build failed. Build log: ${BUILD_LOG}
395+ For full trace: nix build ${REPO_ROOT} #nixosConfigurations.${HOST} .config.system.build.toplevel --no-link --show-trace"
390396ok " Built: ${CLOSURE} "
391397
392398# Harmonia must be running before we can push (it starts after pass-2 rebuild).
0 commit comments