Standalone Nix flake for Cloudflare R2 storage, sync, backup, and sharing.
Caution
This is not ready to be used by other users
- NixOS sync module:
services.r2-sync(rclone mount + bisync services/timers) - NixOS backup module:
services.r2-restic(scheduled restic snapshots to R2) - NixOS annex helper module:
programs.git-annex-r2 - Home Manager CLI surface:
programs.r2-cloud(r2wrapper + tool installation) - Home Manager credentials assembly:
programs.r2-cloud.credentials - Home Manager managed
rclone.conf: generated fromprograms.r2-cloudoptions - Worker subflake: split API + web Workers (Hono API + Astro/Preact UI)
- Worker share tokens support multi-bucket aliases via
R2E_BUCKET_MAP
- Completed: template hardening, option reference docs, operator runbooks, end-user workflow verification, troubleshooting matrix, and docs quality gate.
- CI/CD milestone track in
docs/plan.mdis complete (7.1through7.6).
flake.nix: main flake outputsmodules/: NixOS and Home Manager modulespackages/: CLI package derivationslib/r2.nix: shared library helpersr2-explorer/: API Worker + web Worker subflake and deployment toolingtemplates/: starter flake templatesdocs/: usage and design documentation- navigation entrypoint:
docs/index.md - includes first-line triage in
docs/troubleshooting.md
- navigation entrypoint:
System secrets are standardized in secrets/r2.yaml and extracted by sops-nix
to /run/secrets/r2/*. System services consume the rendered env file at
/run/secrets/r2/credentials.env (from sops templates).
docs/reference/index.mdis the canonical option reference entrypoint.
./scripts/ci/validate.shscripts/ci/validate.sh pins substituters to https://cache.nixos.org/ and clears
extra-substituters so validation does not inherit flaky host-level cache mirrors.
It also evaluates concrete NixOS module configurations for r2-sync and r2-restic
and programs.git-annex-r2, plus Home Manager module assertions for
programs.r2-cloud and programs.r2-cloud.credentials to catch
option/schema regressions early, and
runs documentation quality checks (stale-language scan + reference/docs-link checks),
runs both formatting (nix fmt) and
all pre-commit hooks (lefthook run pre-commit --all-files) in an isolated temp checkout.
The validation flow also runs Worker checks/tests in r2-explorer
(pnpm run check, pnpm run build:web, pnpm run test:api) through
nix develop ./r2-explorer.
If cache access is unavailable, validation disables substituters for that run to avoid
repeated timeout loops. Override cache selection with NIX_VALIDATE_SUBSTITUTERS.
Run a specific CI-equivalent target locally:
./scripts/ci/validate.sh --list-targets
./scripts/ci/validate.sh --target root-cli-module-eval
./scripts/ci/validate.sh --target worker-typecheck-testSet CI_STRICT=1 to fail fast on cache/network issues instead of falling back to
local builds:
CI_STRICT=1 ./scripts/ci/validate.sh- Manual release dispatch workflow:
.github/workflows/release.yml - Release helper scripts:
scripts/release/prepare-changelog.shscripts/release/generate-release-notes.sh
- Versioning and release runbook details:
docs/versioning.md
nix develop
lefthook install
lefthook run pre-commit --all-filesnix fmtnow usestreefmt(configured by.treefmt.toml).- Pre-commit hooks run
treefmt,deadnix, andstatix. treefmtincludesactionlintfor GitHub workflow YAML andtaplo formatfor TOML files (includingwrangler.toml).- Hook environment is loaded via
scripts/lefthook-rc.shfor reproducible tool paths. - Hooks use the lightweight
nix develop .#hooksenvironment to avoid pulling heavy non-hook tooling.