949 B
949 B
nix-cache
Serves a Nix binary cache from Cloudflare R2 with JWT-based authentication.
Only users with a valid Keycloak token and membership in the nix-cache-users
group can read from the cache.
Nix clients authenticate via netrc (Basic auth), while other clients can use Bearer tokens directly. JWTs are verified locally using cached JWKS public keys.
Development
npm install # install dependencies
npm test # run vitest (uses miniflare locally)
npm run dev # start wrangler dev server on localhost:8787
Cloudflare Setup
- Create an A record on the subdomain you want this Worker to run on which
points to
192.0.2.1 - Edit
wrangler.jsonc:routeshould be the subdomain followed by/*bucket_nameshould be the name of the R2 bucket you'll use
- Run
npx wrangler loginto login to Wrangler - Run
npm run deploy - Upload an
index.htmlto your bucket if you want a landing page