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
+2 -2
View File
@@ -289,12 +289,12 @@ Package upgrades (see above)
- **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).
1. **Done (0.13.2):** one "Updates" page with the parts "Router software" and "Packages", one overlay and one confirmation banner, both logs. One check, one preview and one apply for both: see "Unified upgrade" below.
2. **Done (0.13.3, fixed in 0.13.4):** the repository is hardcoded: the module option `routerUpdate.repository` (beside `routerUpdate.publicKeys`; not a `router.*` setting, so it is not in the settings, the options listing or the web UI) defaults to `https://git.stinnesbeck.com/nils/nixos-router`, is baked into `router-update` and written to `/etc/router-update-repository` for the web UI, and the page only names it (no field: a fork or a test sets the option in a module; a moved repository needs a bundle update). `router-update check` (daily timer `router-update-check`, and the page's button) lists the repository's tags with `git ls-remote`, takes the newest `vX.Y.Z` (other tags are ignored) and writes `update/check.json` (repository, time, installed, newest tag/version/revision, newer). The Overview and the Updates page show it while it is about this repository and the installed version.
3. **Done (0.13.3), without a preview:** `router-update --git TAG|latest` (the web UI's "Install"): `nix flake prefetch` of `git+<repo>?ref=refs/tags/<tag>&rev=<commit>`, then the steps of a bundle update from the serial guard on (snapshot, flake, nixpkgs pin, migration, `router-apply` with commit-confirm, rollback). The flake is the source's `config-flake.nix` with `@SOURCE@` replaced by that address, so `flake.lock` and `flake.nix` agree and nothing moves by itself (this file is a contract with every updater already installed: change it only compatibly). The release data (version, serial = the commit's time, schema = the number of `migrations/*.jq`) is read from the fetched source. No signature is checked. Still to do: preview (package changes, download and builds of both inputs), and the nixpkgs-pin interplay for a pin chosen later.
4. **Tag: done (0.13.5).** A release is a tag `vX.Y.Z` on the release commit: `nix run .#release` (which still writes the bundle for the installer and offline routers) ends by creating the annotated tag, locally (push it with the branch; `--no-tag` skips it). It refuses when HEAD's `VERSION` is another version or the tag is on another commit, does nothing outside a git checkout (the VM tests), and tags last so a failed release leaves no tag. Still to do: refuse a `flake.lock` whose nixpkgs is not a channel revision (`git-revision`), so cache.nixos.org has its packages.
5. **Done:** the `update` VM test serves a repository from the builder (`common.gitServer`: `git http-backend` over HTTP) and covers the check, tags that are no releases, refused tags, install through the web UI with migration, confirm, the rebuild without the server, and "not newer".
Bundles and `--url` stay (offline, installer, gitea down).
6. **Unified upgrade (decided 2026-11-26).** nixos-router is a flake input like nixpkgs, so it is part of `router-upgrade`, not a separate update: `router-update check`, `router-update --git`, the unit `router-update-check` and the page's "Releases from git" are gone (steps 2 and 3 above describe where it started). `router-upgrade check` reads the channel's newest nixpkgs revision *and* the repository's newest tag (a repository that cannot be read is a warning; with no channel the packages are skipped) and writes both to `upgrade/check.json` (`router: {repository, installed, newest, newer}`, `packagesUpToDate`, `upToDate` = both); the daily timer (`router-upgrade-notice`) runs `router-upgrade daily` and feeds the Overview notices. `preview` fetches the tag, builds what a release carries (version, serial, schema, migrations, and the flake from `config-flake.nix`), puts the new flake and the migrated settings into a copy of the configuration, locks it (the nixpkgs override as before; without a channel an earlier pin stays), and writes the usual package diff to `preview.json` plus `router: {from, to, tag, rev}`; the page shows one table with the nixos-router row highlighted, and one "Upgrade" button. `apply` refuses when `flake.nix` (or, with a new router, `settings.json`) changed since the preview, and otherwise snapshots, copies flake, migrated settings and lock, writes the pin only when a channel override was used, and runs `router-apply` with commit-confirm as before. The page has no "Update server" any more (it was a setting nobody needs after the hardcoded repository); `router-update` keeps `--url`, `--bundle` and uploads (offline, installer, gitea down), and the page keeps "Install a bundle". Tested in the `update` VM test (check, ignored non-release tags, preview with the router row, apply, confirm, rebuild without the server) and the Go tests.
Web UI polish (list of 2026-11-24)
- Folds inside panels (Packages "What is built here", WireGuard) may jump like the certificate log did.