List the derivations a package upgrade would build

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AeFqV9dZrK6nipHkPfyM4F
This commit is contained in:
2026-11-18 11:42:10 +01:00
co-authored by Claude Sonnet 5.5
parent 38e7613b34
commit 7b4ecee518
5 changed files with 23 additions and 5 deletions
+8 -2
View File
@@ -189,13 +189,19 @@ let
download=$(grep -o '([0-9.]* [KMGT]iB download, [0-9.]* [KMGT]iB unpacked)' <<<"$dry" | head -1 || true)
builds=$(grep -cE '^ +/nix/store/[^ ]*\.drv$' <<<"$dry" || true)
echo " to fetch: ''${download:-nothing, or no cache reachable}; to build here: $builds"
# What would be built here: the derivations' names (the system's own pieces, mostly).
{ grep -E '^ +/nix/store/[^ ]*\.drv$' <<<"$dry" || true; } | sed 's/^ *//' | names | sort -u > ${dir}/builds.txt
sed 's/^/ /' ${dir}/builds.txt | head -n 60
if [ "$(wc -l < ${dir}/builds.txt)" -gt 60 ]; then echo " ... and $(( $(wc -l < ${dir}/builds.txt) - 60 )) more"; fi
release_version=$(jq -r '.version // ""' /etc/router-release 2>/dev/null || true)
jq -n --arg channel "$channel" --arg release "$release_version" --arg rev "$newest" --arg ref "$pin" --arg version "$new_version" \
--arg time "$(date -u +%FT%TZ)" --arg download "$download" --argjson builds "$builds" \
--argjson reboot "$reboot" --slurpfile changes ${dir}/changes.json \
--argjson reboot "$reboot" --slurpfile changes ${dir}/changes.json --rawfile buildNames ${dir}/builds.txt \
'{channel: $channel, release: $release, rev: $rev, ref: $ref, version: $version, time: $time, download: $download,
builds: $builds, rebootNeeded: $reboot, changes: $changes[0]}' > ${dir}/preview.json
builds: $builds, buildNames: ($buildNames | split("\n") | map(select(. != "")) | .[:300]),
rebootNeeded: $reboot, changes: $changes[0]}' > ${dir}/preview.json
rm -f ${dir}/builds.txt
echo "$new_version$([ "$reboot" = false ] || echo ' (a new kernel runs after a reboot)'): router-upgrade apply activates it"
}