One upgrade for nixos-router and the packages

Check, preview and apply look at the repository's release tags and the
channel together; the new nixos-router is a highlighted row in the
preview table. The update server section and the separate git update
are gone; bundles stay.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 11:49:57 +01:00
co-authored by Claude Sonnet 5.5
parent 3e6eee0b9c
commit 2b7cd86e98
15 changed files with 372 additions and 695 deletions
+36 -108
View File
@@ -22,101 +22,12 @@
<p class="muted">The page reloads when it is done. The web UI restarts when an upgrade is switched on, and you log in again.</p>
</div>
</div>
{{else if $u.GitRun.Running}}
<div class="upload-overlay" role="dialog" aria-modal="true">
<div class="upload-card wide">
<h2>Looking at the repository…</h2>
<progress max="100"></progress>
<p>Reading the release tags of <code>{{$u.Repository}}</code>.</p>
{{if $u.GitRun.Log}}<pre class="log">{{$u.GitRun.Log}}</pre>{{end}}
<p class="muted">The page reloads when it is done.</p>
</div>
</div>
{{else if $u.Pending}}
<section class="pending"><h2>Waiting for confirmation</h2>
<p>A new system is active and not confirmed yet. Confirm it on the <a href="/">Overview</a>, or the router goes back to the
previous one.</p></section>
{{end}}
<h2 class="part">Router software</h2>
<section>
<h2>Installed</h2>
<dl>
<dt>Version</dt><dd>{{or $u.Installed.Version "unknown"}}{{if $u.Installed.Rev}} <span class="muted">{{$u.Installed.Rev}}</span>{{end}}</dd>
<dt>Settings schema</dt><dd>{{$u.Installed.Schema}}</dd>
</dl>
</section>
<section>
<h2>Releases from git</h2>
<p>The router looks once a day at the release tags (<code>vX.Y.Z</code>) of <code>{{or $u.Repository "no repository"}}</code>
and says here and on the Overview when a newer one exists. Installing builds it on the router, like a bundle: the
settings are kept (and migrated), and the new version must be confirmed afterwards, or the router goes back. The
repository is trusted as it is: nothing is signed on this path.</p>
{{if $u.Repository}}
<form method="post" action="/update/gitcheck" class="actions">
<input type="hidden" name="csrf" value="{{.CSRF}}">
<button class="secondary"{{if $u.GitRun.Running}} disabled{{end}}>{{if $u.GitRun.Running}}Looking…{{else}}Look for a newer release{{end}}</button>
</form>
{{if and $u.GitRun.Result (ne $u.GitRun.Result "success")}}<p class="error">The last look failed:</p><pre class="log">{{$u.GitRun.Log}}</pre>{{end}}
{{with $u.Git}}
<dl>
<dt>Installed</dt><dd>{{.Installed}}</dd>
<dt>Newest</dt><dd>{{.Newest.Version}} <span class="muted">{{printf "%.7s" .Newest.Rev}}, looked {{.Time}}</span></dd>
</dl>
<form method="post" action="/update/gitinstall">
<input type="hidden" name="csrf" value="{{$.CSRF}}">
<input type="hidden" name="tag" value="{{.Newest.Tag}}">
{{if .Newer}}<p>A newer release is available.</p>
{{else}}<p>Up to date.</p><p><label><input type="checkbox" name="force"> install it anyway</label></p>{{end}}
<button{{if $u.Pending}} disabled{{end}}>{{if .Newer}}Install {{.Newest.Version}}{{else}}Install {{.Newest.Version}} again{{end}}</button>
</form>
{{else}}
<p class="hint">Not looked yet.</p>
{{end}}
{{end}}
</section>
<section>
<h2>Install a bundle</h2>
<p>A <code>.bundle</code> file made with <code>nix run .#release</code>. It is installed only if it is signed with
this router's update key. The settings are kept (and migrated if the new version needs it); the new version
must be confirmed afterwards, or the router goes back.</p>
<form method="post" action="/update/upload?csrf={{.CSRF}}" enctype="multipart/form-data" data-upload>
<p><label><input type="checkbox" name="force"> also install a version that is not newer</label></p>
<p><input type="file" name="bundle" required> <button>Upload and install</button></p>
</form>
</section>
<section>
<h2>Update server</h2>
<form method="post" action="/update/url" class="actions">
<input type="hidden" name="csrf" value="{{.CSRF}}">
<label>Address <input name="url" value="{{$u.URL}}" size="40" placeholder="https://updates.example.com/router"></label>
<button class="secondary">Save</button>
</form>
{{if $u.URL}}
<form method="post" action="/update/check" class="actions">
<input type="hidden" name="csrf" value="{{.CSRF}}">
<button class="secondary">Check for updates</button>
</form>
{{end}}
{{if $u.OfferErr}}<p class="error">Could not check: {{$u.OfferErr}}</p>{{end}}
{{with $u.Offer}}
<p>{{if .Newer}}Available: <strong>{{.Version}}</strong>{{if .Rev}} <span class="muted">{{.Rev}}</span>{{end}}.{{else}}Nothing newer: the server has {{.Version}}.{{end}}</p>
<form method="post" action="/update/install">
<input type="hidden" name="csrf" value="{{$.CSRF}}">
{{if not .Newer}}<p><label><input type="checkbox" name="force"> install it anyway</label></p>{{end}}
<button>{{if .Newer}}Install {{.Version}}{{else}}Install{{end}}</button>
</form>
{{end}}
<p class="hint">The server only has to serve static files: the <code>latest</code> file and <code>cache/</code> that
<code>nix run .#release</code> writes. The data is signed, so plain HTTP works too.</p>
</section>
<h2 class="part" id="packages">Packages</h2>
{{with $g.NewerRelease}}
<section class="notice">
<h2>NixOS {{.}} is out</h2>
@@ -130,14 +41,16 @@
</section>
{{end}}
<section>
<h2>Channel</h2>
<p>Upgrades the kernel and all programs (NixOS) without a new release of nixos-router. Nothing is downloaded until
you ask for it, and an upgrade is activated like a settings change: unless you confirm it in time, the router
goes back to the previous system.</p>
<section id="packages">
<h2>Installed</h2>
<dl>
<dt>Running</dt><dd>{{or $g.Version "unknown"}}</dd>
<dt>nixos-router</dt><dd>{{or $g.Router.Version "unknown"}}{{if $g.Router.Rev}} <span class="muted">{{printf "%.7s" $g.Router.Rev}}</span>{{end}}</dd>
<dt>Settings schema</dt><dd>{{$g.Router.Schema}}</dd>
<dt>NixOS</dt><dd>{{or $g.Version "unknown"}}</dd>
</dl>
<p>An upgrade brings the newest nixos-router{{if $g.Repository}} (from <code>{{$g.Repository}}</code>){{end}} and the packages
(the kernel and all programs) of the channel you follow. Nothing is downloaded until you ask for it, and an upgrade is
activated like a settings change: unless you confirm it in time, the router goes back to the previous system.</p>
<form method="post" action="/upgrade/channel" class="actions">
<input type="hidden" name="csrf" value="{{.CSRF}}">
<label>Follow
@@ -148,12 +61,12 @@
<button class="secondary">Save</button>
</form>
{{if $g.ReleasesSeen}}<p class="hint">Stable releases as the channel server listed them on {{$g.ReleasesSeen}}; Check for upgrades asks again.</p>{{end}}
<p class="hint">The channel only chooses what an upgrade offers; saving it changes nothing on the router. Going back to an older release
<p class="hint">The channel only chooses which packages an upgrade offers; saving it changes nothing on the router. Going back to an older release
(unstable to 26.05) is refused unless you tick "downgrade anyway" when previewing; state written by the newer
release may not work with the older one.</p>
</section>
{{if $g.Channel}}
{{if or $g.Channel $g.Repository}}
<section>
<h2>Check</h2>
<form method="post" action="/upgrade/check" class="actions">
@@ -162,11 +75,11 @@
</form>
{{with $g.Check}}
<dl>
<dt>Channel</dt><dd>{{.Branch}}</dd>
<dt>Running</dt><dd>{{.Running.Version}}</dd>
<dt>Newest</dt><dd>{{printf "%.7s" .Newest.Rev}} <span class="muted">checked {{.Time}}</span></dd>
{{with .Router}}<dt>nixos-router</dt><dd>{{.Installed}}{{if .Newer}} → <strong>{{.Newest.Version}}</strong>{{else}} <span class="muted">(the newest)</span>{{end}}</dd>{{end}}
{{if .Channel}}<dt>Packages</dt><dd>{{.Channel}}: {{printf "%.7s" .Newest.Rev}}{{if .PackagesUpToDate}} <span class="muted">(what runs)</span>{{else}} <strong>newer than the running {{printf "%.7s" .Running.Rev}}</strong>{{end}}</dd>{{end}}
<dt>Checked</dt><dd>{{.Time}}</dd>
</dl>
{{if .UpToDate}}<p>Up to date.</p>{{else}}<p>A newer revision is available.</p>{{end}}
{{if .UpToDate}}<p>Up to date.</p>{{else}}<p>A newer version is available.</p>{{end}}
{{end}}
</section>
@@ -178,15 +91,19 @@
<label><input type="checkbox" name="downgrade"> downgrade anyway</label>
<button class="secondary"{{if or $g.Run.Running $g.Updating}} disabled{{end}}>Preview</button>
</form>
<p class="hint">Works it out from the new revision's description: no package is downloaded.</p>
<p class="hint">Works it out from the new versions' descriptions: no package is downloaded.</p>
{{with $g.Preview}}
<p>{{$g.Version}} → <strong>{{.Version}}</strong> <span class="muted">{{printf "%.7s" .Rev}}, previewed {{.Time}}</span></p>
{{if .Changes}}
<p>{{$g.Version}} → <strong>{{.Version}}</strong> <span class="muted">{{if .Rev}}{{printf "%.7s" .Rev}}, {{end}}previewed {{.Time}}</span></p>
{{if or .Router .Changes}}
<table>
<thead><tr><th>Package</th><th>Now</th><th></th><th>New</th></tr></thead>
<tbody>{{range .Changes}}<tr><td>{{.Name}}</td><td>{{.From}}</td><td>→</td><td>{{.To}}</td></tr>{{end}}</tbody>
<tbody>
{{with .Router}}<tr class="highlight" title="This upgrade also installs a new version of nixos-router itself, and migrates the settings to it if it needs that."><td>nixos-router</td><td>{{.From}}</td><td>→</td><td>{{.To}}</td></tr>{{end}}
{{range .Changes}}<tr><td>{{.Name}}</td><td>{{.From}}</td><td>→</td><td>{{.To}}</td></tr>{{end}}
</tbody>
</table>
{{else}}<p>No package changes.</p>{{end}}
{{if .Router}}<p class="hint">The highlighted row is the router software itself: this upgrade installs it too.</p>{{end}}
<p class="hint">The list shows the versions of programs the router runs; a program that is only rebuilt does not appear.</p>
<dl>
<dt>To download</dt><dd>{{or .Download "nothing, or the package cache cannot be reached"}}</dd>
@@ -208,7 +125,7 @@
</form>
<form method="post" action="/upgrade/apply">
<input type="hidden" name="csrf" value="{{$.CSRF}}">
<button{{if or $g.Run.Running $g.Updating $g.Pending}} disabled{{end}}>Upgrade to {{.Version}}</button>
<button{{if or $g.Run.Running $g.Updating $g.Pending}} disabled{{end}}>Upgrade{{with .Router}} nixos-router to {{.To}} and{{end}} to {{.Version}}</button>
</form>
</div>
<p class="hint">Downloading first lets you start the upgrade later without needing the internet. Upgrading
@@ -219,16 +136,27 @@
<section><p>Choose a channel to look for upgrades.</p></section>
{{end}}
<section>
<h2>Install a bundle</h2>
<p>For a router without a route to the repository, or when it is down: a <code>.bundle</code> file made with
<code>nix run .#release</code>. It is installed only if it is signed with this router's update key. The settings are kept
(and migrated if the new version needs it); the new version must be confirmed afterwards, or the router goes back.</p>
<form method="post" action="/update/upload?csrf={{.CSRF}}" enctype="multipart/form-data" data-upload>
<p><label><input type="checkbox" name="force"> also install a version that is not newer</label></p>
<p><input type="file" name="bundle" required> <button>Upload and install</button></p>
</form>
</section>
{{if and $u.Status.Log (not $u.Status.Running)}}
<section>
<h2>Last update{{if $u.Status.Result}} — {{if eq $u.Status.Result "success"}}succeeded{{else}}failed ({{$u.Status.Result}}){{end}}{{end}}</h2>
<h2>Last bundle update{{if $u.Status.Result}} — {{if eq $u.Status.Result "success"}}succeeded{{else}}failed ({{$u.Status.Result}}){{end}}{{end}}</h2>
<pre class="log">{{$u.Status.Log}}</pre>
</section>
{{end}}
{{if and $g.Run.Log (not $g.Run.Running)}}
<section>
<h2>Last package run{{if $g.Run.Result}} — {{if eq $g.Run.Result "success"}}succeeded{{else}}failed ({{$g.Run.Result}}){{end}}{{end}}</h2>
<h2>Last upgrade run{{if $g.Run.Result}} — {{if eq $g.Run.Result "success"}}succeeded{{else}}failed ({{$g.Run.Result}}){{end}}{{end}}</h2>
<pre class="log">{{$g.Run.Log}}</pre>
</section>
{{end}}