cf-edgeNix

cf-edgeNix

R2 が正本、KV と Cache API が速度層。Workers の Free Tier だけで動く、グローバル分散の Nix binary cache。5 分 cron が請求前に kill-switch を引きます。

configuration.nix
{
  nix.settings = {
    extra-substituters = [
      "https://t4ko.pet"
    ];
    extra-trusted-public-keys = [
      "nix.t4ko.pet-1:0eRO18L1/5diWYWboKKPTejQGhGCHNITwELiUaX7Kps=%"
    ];
  };
}

nixos-rebuild switch でそのまま substituter として利用できます。

Edge で完結する read path。

高速で安く、署名で安全。Cloudflare の primitives を素直に組んだだけのアーキテクチャです。

Edge-first reads

narinfo は memory → KV → R2、NAR 本体は Cache API → R2。D1 は read path に一切乗らない。

Signed & verifiable

Ed25519 で署名された .narinfo と zstd 圧縮の NAR を /nar/<hash>.nar.zst で配信。

Free-tier safe

5 分 cron で R2 / Class A / Class B を監視。80% で warn、95% で 503 を返す kill-switch。

Three-phase publish

start → ingest × N → finalize。NAR が narinfo に先行し、D1 commit が KV warming に先行する。

3 tier lookup, 1 source of truth.

narinfo の読みは memory(L0 isolate)→ KV(L1)→ R2(正本)の順。 KV は結果整合、R2 が常に正本です。404 はそのまま client に伝播し、次の substituter に fall-through します。

Read the spec
Nix client ─▶ Worker
└▶ memory (L0)
└▶ KV META_KV
└▶ R2 NAR_BUCKET