···11631163 myflake: github:me/x
11641164```
1165116511661166-#### Caches
11661166+#### Substituters
1167116711681168-The `caches` field is a map of Nix binary cache URL to its
11681168+The `substituters` field is a map of Nix binary cache URL to its
11691169trusted public key. These are fed into the spindle's read
11701170proxy, so the guest can substitute prebuilt paths from them
11711171instead of building everything from scratch.
1172117211731173```yaml
11741174-caches:
11741174+substituters:
11751175 https://nix-community.cachix.org: "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
11761176```
11771177
···1414Currently two kinds of images are supported:
15151616- NixOS images: these allow configuration such as `dependencies`, `services`,
1717- `virtualisation`, `registry`, `caches` in the workflow file itself. The guest
1717+ `virtualisation`, `registry`, `substituters` in the workflow file itself. The guest
1818 agent will build (or if it's cached, spindle will send the store path for
1919 realization) and activate it before any workflow steps are ran.
2020- Non-NixOS: this is mainly just Alpine for now, but can be anything else.
···1717 handler http.Handler
1818}
19192020-func newHTTPUploadProxyBackend(target *url.URL, readUpstreams []CacheUpstream, logger *slog.Logger) *httpUploadBackend {
2020+func newHTTPUploadProxyBackend(target *url.URL, readUpstreams []SubstituterUpstream, logger *slog.Logger) *httpUploadBackend {
2121 return &httpUploadBackend{handler: uploadProxyHandler(target, readUpstreams, logger)}
2222}
2323···27272828func (b *httpUploadBackend) Close() error { return nil }
29293030-func uploadProxyHandler(target *url.URL, readUpstreams []CacheUpstream, logger *slog.Logger) http.Handler {
3030+func uploadProxyHandler(target *url.URL, readUpstreams []SubstituterUpstream, logger *slog.Logger) http.Handler {
3131 rp := httputil.NewSingleHostReverseProxy(target)
3232 rp.ErrorLog = slog.NewLogLogger(logger.Handler(), slog.LevelError)
3333···46464747 // before uploading, nix copy asks the destination whether it already has each
4848 // path by GET/HEAD-ing <hash>.narinfo and skips the ones it does. we answer
4949- // that check across the upload target *and* the read caches: if any of them
4949+ // that check across the upload target *and* the read substituters: if any of them
5050 // already serves the path there is no point uploading it (the guest would
5151 // just substitute it from there anyway).
5252- narinfoUpstreams := append([]CacheUpstream{{url: target}}, readUpstreams...)
5252+ narinfoUpstreams := append([]SubstituterUpstream{{url: target}}, readUpstreams...)
5353 exists := newNarinfoExistenceTransport(narinfoUpstreams, logger)
54545555 return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
···6161 })
6262}
63636464-func newNarinfoExistenceTransport(upstreams []CacheUpstream, logger *slog.Logger) http.RoundTripper {
6464+func newNarinfoExistenceTransport(upstreams []SubstituterUpstream, logger *slog.Logger) http.RoundTripper {
6565 return ¶llelRacingTransport{
6666 upstreams: upstreams,
6767 underlying: proxyTransport,