feeds: Vendor repository indexes

Keep the native APK indexes alongside the expanded package
metadata so image builds do not fetch mutable repository state.

Generate pins atomically and retry transient generation failures.
This commit is contained in:
2026-08-23 23:03:14 +01:00
parent 8248f82ebb
commit 53720becf1
34 changed files with 42526 additions and 23114 deletions
+16 -3
View File
@@ -42,9 +42,11 @@ point release, so it changes whenever any package in it is rebuilt. Upstream ref
once a day and routinely loses that race.
Regenerating locally writes the *expanded* per-package files (`cache/<release>/packages/<arch>/`),
which `nix-openwrt-imagebuilder` imports directly. That removes the import-from-derivation, leaves
every `.apk` as a plain pinned `fetchurl`, and makes the pin something to move deliberately rather
than something upstream moves daily.
which `nix-openwrt-imagebuilder` imports directly. It also vendors the repository indexes and
rewrites their generated `sourceInfo.url` values to flake-local `file://` URLs. That removes the
import-from-derivation, keeps image builds from fetching mutable indexes, leaves every `.apk` as a
plain pinned `fetchurl`, and makes the pin something to move deliberately rather than something
upstream moves daily.
The generated files are large — a few MB per release, rewritten wholesale each time — which is why
they are kept in a repository of their own rather than in the history of whatever consumes them.
@@ -60,6 +62,16 @@ nix run .#update
This rewrites `cache/` for every entry in `pins` in `flake.nix`. Review and commit the result, then
update the pin in the consuming flake.
Pass a release to regenerate only that pin:
```sh
nix run .#update -- 25.12.5
```
Each release is generated in a temporary directory and replaces its existing cache only after all
metadata and repository indexes have been fetched successfully. Transiently inconsistent upstream
metadata therefore leaves the existing pin intact.
Adding a release or target means adding it to `pins` and re-running. Note that
`cache/<release>/default.nix` lists every target in the release, but only the ones generated here
exist on disk; the others are referenced lazily and are never evaluated.
@@ -69,6 +81,7 @@ exist on disk; the others are referenced lazily and are never evaluated.
| Path | Contents |
|---|---|
| `cache/<release>/default.nix` | Per-target entry points for the release |
| `cache/<release>/indexes/` | Vendored package repository indexes used by the image build |
| `cache/<release>/targets/<target>/<variant>/` | ImageBuilder hash, `profiles.json` extract, kmod and target package feeds |
| `cache/<release>/packages/<arch>.nix` | Feed index hashes for the target's architecture |
| `cache/<release>/packages/<arch>/<feed>.nix` | Expanded per-package versions, dependencies and hashes |