# jetstream: AT Protocol event firehose proxy for local development. # # Subscribes to a PDS's com.atproto.sync.subscribeRepos and re-broadcasts # events over WebSocket in a simplified JSON format. # # Key env vars: # JETSTREAM_WS_URL — upstream ATProto firehose URL # JETSTREAM_LISTEN_ADDR — WebSocket listen address (default :6008) # JETSTREAM_DATA_DIR — PebbleDB cursor storage directory { lib, buildGoModule, fetchFromGitHub, }: buildGoModule { pname = "jetstream"; version = "0-unstable-2024-06-18"; src = fetchFromGitHub { owner = "bluesky-social"; repo = "jetstream"; rev = "a003f34cdb510c37d7245f0965814a6168243812"; hash = "sha256-VMSOHTTLr+wFI0NQthGJvlj1oQkTlFSjWkfbRRLqM0A="; }; vendorHash = "sha256-UvJQ27BZ9Pri8zhY+T40qvH+g5ZInENQqSby+Z+lReg="; proxyVendor = true; subPackages = ["cmd/jetstream"]; # CGO is needed for PebbleDB's zstd compression (DataDog/czstd) env.CGO_ENABLED = 1; # Disable the 15-second liveness checker that kills Jetstream when idle. # It's designed for Docker (restart on crash) but we run natively. # In local dev there may be long periods with no events. postPatch = '' substituteInPlace cmd/jetstream/main.go \ --replace-fail 'close(livenessKill)' '// disabled for local-dev: close(livenessKill)' ''; # The go.sum needs updating for newer Go toolchains overrideModAttrs = _: { preBuild = '' go mod tidy ''; }; preBuild = '' go mod tidy ''; meta = { description = "AT Protocol event firehose proxy"; homepage = "https://github.com/bluesky-social/jetstream"; license = lib.licenses.mit; platforms = lib.platforms.unix; mainProgram = "jetstream"; }; }