Ignore a package preview made by another nixos-router

A preview is kept until the next one; after an update it could still show
the list the older version made.

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 09:00:44 +01:00
co-authored by Claude Sonnet 5.5
parent 6e097b7473
commit 163df5966d
3 changed files with 26 additions and 5 deletions
+4 -2
View File
@@ -67,6 +67,7 @@ type UpgradeChange struct {
// UpgradePreview is preview.json.
type UpgradePreview struct {
Channel string `json:"channel"`
Release string `json:"release"` // the nixos-router that made it
Rev string `json:"rev"`
Version string `json:"version"`
Time string `json:"time"`
@@ -179,12 +180,13 @@ func (a *app) upgradeData() upgradeData {
}
var c UpgradeCheck
// What was checked before another channel was chosen or before the last
// upgrade says nothing about now.
// upgrade says nothing about now; nor does a preview that another
// nixos-router made (it may list packages differently).
if readUpgradeFile(filepath.Join(a.sys.upgradeDir(), "check.json"), &c) && c.Channel == d.Channel && c.Running.Version == d.Version {
d.Check = &c
}
var p UpgradePreview
if readUpgradeFile(filepath.Join(a.sys.upgradeDir(), "preview.json"), &p) && p.Channel == d.Channel {
if readUpgradeFile(filepath.Join(a.sys.upgradeDir(), "preview.json"), &p) && p.Channel == d.Channel && p.Release != "" && p.Release == a.sys.installedRelease().Version {
d.Preview = &p
}
return d