Put the Update and Packages pages on one Updates page

Router software and packages are two parts of one page, with one overlay,
one confirmation banner and both logs. /upgrade redirects to it; the
actions keep their addresses.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-24 22:55:54 +01:00
co-authored by Claude Sonnet 5.5
parent 4aef47a350
commit 9cb2d28ea1
11 changed files with 231 additions and 192 deletions
+21 -3
View File
@@ -234,7 +234,7 @@ Upgrading nixpkgs (the kernel and every package) on the router, without a new re
- **`download`**: fetches and builds it (needs 3 GiB free), so a flaky uplink does not matter at `apply`.
- **`apply [timeout]`**: takes the previewed lock into the configuration directory and runs `router-apply` (commit-confirm). The directory as it was is kept in `config.pre-update` like for updates: a rollback or a failed build puts the lock back. Refused if the configuration flake changed since the preview.
- **Pin**: `nixpkgs-pin.json` in the configuration directory (channel, revision, flake reference with `narHash`). `router-update` locks it again after it installs a new release of nixos-router, so a release does not undo an upgrade; the reference is found in the store by its hash, offline.
- **Web UI page** `/upgrade` ("Packages", under System): the channel as a select (none, `unstable`, and the stable releases in `stableChannels` in `upgrade.go`, 26.05 for now, until the router can ask the channel server which exist: the running release says nothing, since nixos-unstable already calls itself the next one; a configured channel that is none of these stays listed; saved to `settings.json` and the confirmed settings, so it never shows as unapplied), buttons Check, Preview (with "look anyway" when up to date), Download now and Upgrade. The preview shows the version table, download size, local builds (a warning above 50) and a reboot note for a new kernel. The page asks for a step in `upgrade/request.json` and starts `router-upgrade.service`, which runs `router-upgrade --request` (not restarted or stopped by a switch, like `router-apply`); it shows `check.json`/`preview.json` (not those of another channel, nor a check from before the last upgrade) and `upgrade/last.log`, which the unit tees (a finished one-shot unit has no journal to find). Download and Upgrade need a preview and no change waiting for confirmation; a request without a `channel` field is refused rather than clearing it.
- **Web UI page** (since 0.13.2 the "Updates" page `/update`, the packages part at `#packages`; `GET /upgrade` redirects there, the `POST /upgrade/*` actions are unchanged; before, "Packages" was a page of its own): the channel as a select (none, `unstable`, and the stable releases in `stableChannels` in `upgrade.go`, 26.05 for now, until the router can ask the channel server which exist: the running release says nothing, since nixos-unstable already calls itself the next one; a configured channel that is none of these stays listed; saved to `settings.json` and the confirmed settings, so it never shows as unapplied), buttons Check, Preview (with "look anyway" when up to date), Download now and Upgrade. The preview shows the version table, download size, local builds (a warning above 50) and a reboot note for a new kernel. The page asks for a step in `upgrade/request.json` and starts `router-upgrade.service`, which runs `router-upgrade --request` (not restarted or stopped by a switch, like `router-apply`); it shows `check.json`/`preview.json` (not those of another channel, nor a check from before the last upgrade) and `upgrade/last.log`, which the unit tees (a finished one-shot unit has no journal to find). Download and Upgrade need a preview and no change waiting for confirmation; a request without a `channel` field is refused rather than clearing it.
- **Module options** (for tests): `routerSettings.upgrade.channelsUrl`, `routerSettings.upgrade.nixpkgsRef` (`%rev%`).
- **Test** (`apply`): the channel is a small HTTP server on the client that redirects like channels.nixos.org, and the "newer" nixpkgs is the installed one under a `path:` reference with the same `lastModified` and `rev`: a really different nixpkgs cannot be built offline (any version change rebuilds the NixOS tools). Covers check, preview (including the package-list rules), download, an unconfirmed upgrade rolled back with its lock and pin, a confirmed one, and a failing build.
@@ -284,6 +284,24 @@ On the user's own router (settings and infrastructure, not code)
5. **Web UI and remote access** — pages for every setting, themes, MCP server, REST API. *Done* (0.12.0); see "Not done yet".
Package upgrades (see above)
- **New NixOS release**: look for newer `nixos-YY.MM` branches and say so; mark releases the installed nixos-router was not tested with.
- **Tested revisions**: a signed manifest in the release naming the nixpkgs revisions the tests passed on, as a gate in front of the channel's tip.
- **New NixOS release**: *done in 0.13.1* (the notice and the channel list). Still open: mark releases the installed nixos-router was not tested with.
- **Tested revisions**: a signed manifest in the release naming the nixpkgs revisions the tests passed on, as a gate in front of the channel's tip (the "not tested" mark depends on it).
- **Reset**: go back to the nixpkgs that came with the release (`channel = null` and remove the pin).
- **Real package changes in tests**: the upgrade tests use an identical nixpkgs copy, so no real version change is ever exercised.
- **Merge the Update and Packages pages, and take releases from git** (decided 2026-11-24, not built). The repository is public, so no key is needed on the router; trusting the git server (TLS and the tag) is enough, so no signatures on this path; the packages come from cache.nixos.org and the small parts of nixos-router are built on the router; gitea has to be reachable to update this way. Plan:
1. **Done (0.13.2):** one "Updates" page with the parts "Router software" and "Packages", one overlay and one confirmation banner, both logs. Still to do for it: one check, one preview and one apply for both (needs step 3).
2. `router.update.repository` (a git URL). A daily check (`git ls-remote --tags`, newest `vX.Y.Z`) shows "0.x.y is available" on the Overview, like the release notice.
3. Preview and apply lock the configuration flake to the tag (`--override-input nixos-router git+<url>?rev=…`) next to the nixpkgs pin, evaluate once and show the package changes, download and builds of both together; the serial guard and the settings migration run as for bundles.
4. A release is a tag on the commit (`router-release` can still write a bundle for offline routers and the installer). The nixpkgs in the repository's `flake.lock` must be a revision of a channel (`git-revision`), so cache.nixos.org has its packages.
5. VM test with a git server in the client VM (`git+http://`), as `channelServer` stands in for channels.nixos.org.
Bundles and `--url` stay (offline, installer, gitea down).
Web UI polish (list of 2026-11-24)
- Folds inside panels (Packages "What is built here", WireGuard) may jump like the certificate log did.
- Other confirmations still use the browser's dialog, not the in-page box; tooltips (firewall headers) do not work on touch; the diff does not mark changed words.
Monitoring
- Alert rules and a Grafana dashboard for the Prometheus metrics; per-LAN traffic.
On the user's own router
- Apply the saved port 4001 forwards (to 192.168.168.254, tcp+udp) and check them end to end (a NodePort 30401 would need `toPort`); install 0.13.1 and look at the Prometheus page and the release notice.