NixOS build and cache
The builder flake host is nix-builder.cazzzer.com. Router reservations assign
10.17.1.20 and the LAN IPv6 prefix plus ::20:1. NetworkManager pins the
matching DUID and SLAAC token; local DNS returns .20 and the LAN ULA ::20:1.
Woodpecker connects to woodpecker-grpc.cazzzer.com with TLS and certificate
verification. Its local backend is restricted by repository and builder labels;
only trusted push/manual workflows should run on it. The pipeline discovers
all flake hosts and builds sequentially into the VM store. Stable indirect GC
roots in /var/lib/nix-ci/<host> preserve each last successful closure.
Secrets
hosts/builder/secrets/*.age are encrypted to the builder SSH host public key.
Back up /etc/ssh/ssh_host_ed25519_key securely: it is required to recover these
secrets. Secrix decrypts the signing key and CI credentials into service runtime
directories. The transcrypt password is read from
/run/nix-builder-ci-secrets/transcrypt-password; the Woodpecker repository
secret is no longer required after deploying this change and pipeline.
The migrated agent environment contains the existing token; rotate the token
and re-encrypt that file before deploying it, since it appeared in tool output.
Existing plaintext files on the VM are left in place for rollback. Remove
/var/lib/woodpecker/agent.env and /var/lib/nix-cache/cache-key.sec after
verifying the secrix-managed services and retaining a secure recovery backup.
Cloudflare credentials are stored alongside the other encrypted secrets:
cloudflare-dns.env.age: plaintext formatCF_API_TOKEN=<token>, with a Cloudflare API token scoped to DNS Edit and Zone Read forcazzzer.com.cloudflare-tunnel-token.age: raw token for a remotely managed tunnel.
Encrypt each file using nix run .#secrix -- -h to inspect the pinned CLI, or
pipe it through age -a -r <builder SSH public key> -o <destination>.age.
Never put plaintext credentials in the repository or Nix store. All referenced
credentials are required; missing files fail the build rather than disabling services.
HTTPS and tunnel
Caddy uses DNS-01 with the Cloudflare provider and explicit Cloudflare DNS
resolvers. It proxies HTTPS to nix-serve-ng on 127.0.0.1:5000. The raw cache
port is closed externally. When enabled, the firewall opens TCP 80/443 and UDP
443; SSH remains enabled through the common host configuration. The tunnel
requires outbound connectivity only.
Tunnel ingress is declared in hosts/builder/https.nix: the builder hostname
proxies to https://localhost:443 with the expected origin server name and
certificate verification enabled. The proxied public DNS CNAME points to the
tunnel. Caddy requires basic authentication for every cache request through
both the LAN and tunnel routes. If remote tunnel configuration is later added
in Cloudflare, keep its ingress consistent with the repository.
Client authentication
The username is nix-cache. The password and its bcrypt hash live in
vars/private.nix under cache, protected in Git by the existing transcrypt filter.
Caddy uses the hash; every host imports the shared credentials to generate
/etc/nix/netrc with mode 0600. No per-host SSH recipients or manual credential
distribution are required for basic auth. Decrypt transcrypt before building any
host, including new generic VM images.
Generating netrc this way also places the plaintext cache password in the Nix store, which local users can read and the cache may serve. This is a deliberate tradeoff approved for this cache password; transcrypt protects the Git copy, not build outputs. Secrix remains responsible for Cloudflare tokens, the cache signing key, and Woodpecker credentials.
Rotating the password requires updating both password and bcrypt hash in the shared private file, then rebuilding the builder and clients.
Shared Caddy package
vars/default.nix defines the shared domain and derived service hostnames.
It exposes transcrypt-managed shared values as vars.private; runtime secrets
managed by secrix remain in their host/module secrets directories.
pkgs/caddy-cloudflare.nix defines the Cloudflare plugin version and build hash
once. Both router and builder call this package. Their routing and credential
configuration stays in their respective service modules.
Deployment and checks
- Ensure Cloudflare credentials are present and rotate the previously exposed agent token.
- Build and deploy the router reservations/DNS before renewing the builder's network connection. Avoid simultaneously switching DHCP identity and routing without a working console or recovery connection.
- Build and deploy
.#nixosConfigurations.builder.config.system.build.toplevel. Set its transient hostname tonix-builderif an old DHCP hostname persists. - Verify
woodpecker-agent-nix,nix-serve,caddy, andcloudflared-nix-builderservices and their secrix key units. - Verify LAN and external HTTPS access, signed narinfo responses, and a complete CI run. Rebuild clients to install the new HTTPS substituter URL.
New files must be added to Git for Git-flake builds; path:. includes untracked
files during local validation. Weekly GC deletes unrooted paths older than 14
days. Monitor the 100 GiB VM disk as desktop closures grow.