Provide the write token
Set NIX_CACHE_WRITE_TOKEN in the CI job, or pass --token-file. Keep the token in your CI secret store and never commit it.
export NIX_CACHE_WRITE_TOKEN=<WRITE_TOKEN>
Manage packages, build versions, files, retention, and garbage collection.
The token is kept in this browser tab until the tab is closed.
Every action below targets a build version. Package rows are grouping and inspection only.
| Package / version | Tags | Files | Bytes | Registered | Retention | Actions |
|---|
Define which versions match, how they are grouped, and when automatic garbage collection may remove them.
Conditions are combined with AND. Grouping controls where newest versions are counted.
Add conditions only when the rule should be narrower than all versions.
lastN is calculated independently for each group. Leave empty for one global group.
These controls are combined: keep-newest and pinned versions are protected from automatic GC; capacity may make older versions eligible before the duration expires.
Protected versions are never removed by automatic GC.
Over-capacity versions may be removed before the duration expires.
Older unprotected versions become eligible after this age.
Cache-info values, the optional R2 public URL, and default retention are deployment environment variables. Change them with Wrangler and redeploy.
Use the Worker URL for publishing. The optional R2 Custom Domain is for anonymous downloads only. Keep the write token in your CI secret store.
Set NIX_CACHE_WRITE_TOKEN in the CI job, or pass --token-file. Keep the token in your CI secret store and never commit it.
export NIX_CACHE_WRITE_TOKEN=<WRITE_TOKEN>
Run bin/nix-cache-upload against the Worker URL. NARs go to temporary private R2 staging keys; the client verifies and promotes them before publishing narinfo.
NIX_CACHE_WRITE_TOKEN=<WRITE_TOKEN> bin/nix-cache-upload --to https://nix-cache.ihc.im --package acme --version ci-123 ./result
The bundled client publishes narinfos and registers the complete package/version declaration automatically. Use the API below only for a manual integration; narinfoKeys lists uploaded narinfo keys, while tags and retentionDays are optional metadata.
curl -X PUT "https://nix-cache.ihc.im/api/packages/acme/versions/2026.08.18" -H "Authorization: Bearer $WRITE_TOKEN" -H "Content-Type: application/json" --data '{
"narinfoKeys": ["abc123.narinfo"],
"tags": { "channel": "stable", "system": "x86_64-linux" },
"retentionDays": 30
}'Registration is idempotent. It is a complete declaration: omitted members and tags are removed from that version.