nixos-configs-input-cache
A Gitea-side cache of the github: flake inputs used by
johno/nixos-configs CI, but
not served by any substituter (so their source must otherwise be fetched from
github, which the ci-build runner cannot reach reliably).
Why this exists (Canon CI-005)
The ci-build runner cannot reach api.github.com (every TCP connect to
api.github.com:443 times out at the 5s connect-timeout) and github.com
codeload is only intermittent from it. During a sustained github-egress
outage, nix flake check reds on every flake input whose source no
substituter serves. This cache lets the pre-warm fetch those sources from the
Gitea forge (always reachable from the runner) instead. See the CI-005 fix PR
on johno/nixos-configs and johno/polaris/canon/CI-005-ci-default-branch-green.md.
Layout
One orphan branch per input, named <owner>-<repo> (matching the
github: input's original.owner/original.repo in flake.lock), holding
exactly that input's source tree at its locked rev. No sidecar files — the
branch tree must be byte-for-byte the upstream tree so the NAR matches
flake.lock's narHash.
The CI pre-warm fetches:
https://git.johnogle.info/ash-bot/nixos-configs-input-cache/archive/<owner>-<repo>.tar.gz
with sha256 = <flake.lock narHash>. builtins.fetchTarball verifies the
unpacked NAR, so the store path is identical to the github: fetch —
nix flake check finds it cached and never touches github. The repo is
public (it mirrors only public upstream sources; no secrets) so the
fetch needs no auth token.
Verifying a branch
nix eval --impure --raw --expr \
'(builtins.fetchTarball { url = "https://git.johnogle.info/ash-bot/nixos-configs-input-cache/archive/<owner>-<repo>.tar.gz"; sha256 = "<narHash>"; })'
It should print a /nix/store/...-source path with no error.
Updating on a flake.lock bump
When an input's locked rev changes (e.g. Renovate), re-populate that input's branch from a host with github egress (the Paseo pod has it; the runner does not):
rev=<new-locked-rev>
store=$(nix eval --impure --raw --expr \
"(builtins.fetchTarball { url = \"https://github.com/<owner>/<repo>/archive/$rev.tar.gz\"; sha256 = \"<new-narHash>\"; })")
git checkout --orphan <owner>-<repo>
git rm -rf --cached . 2>/dev/null || true
cp -a "$store/." . && chmod -R u+w .
git add -A && git commit -m "cache: <owner>/<repo> @ $rev" && git push -f origin <owner>-<repo>
Until the branch is updated, the pre-warm's narHash verification fails for that input (integrity gate) and it falls back to the github.com archive path (the original behavior) — so a stale cache degrades gracefully rather than serving wrong content.