cf-edgeNix

cf-edgeNix

R2 が正本、Workers Cache が配信キャッシュ。Cloudflare の無料枠を活用する、グローバル分散の 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 と NAR 本体は Workers Cache → 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 → R2 upload → finalize。NAR を narinfo より先に保存し、D1 で公開を確定する。

Edge cache, R2 source of truth.

narinfo は Workers Cache から返し、miss 時は R2 の正本を直接読みます。 存在しない path は 404 を返し、次の substituter に fall-through します。

Read the spec
Nix client ─▶ Workers Cache
└▶ Worker
└▶ R2 NAR_BUCKET