Skip to content

Getting started

This page sets up a Linux workstation to build any SVRBC project. You need two things: Nix, which supplies the pinned tools a build runs, and Bazelisk, which runs the version of Bazel that each repository asks for. Builds then read the shared cache automatically.

Use the official multi-user (daemon) installer. It needs sudo and asks a few questions, so run it in a real terminal:

Terminal window
sh <(curl -L https://nixos.org/nix/install) --daemon

Open a new terminal afterwards so your shell picks up the Nix profile, then check it:

Terminal window
nix --version

Bazel uses Nix only to fetch tools from nixpkgs at the versions a repository pins. You don’t need to learn Nix to build a project.

Bazelisk is a single binary. It reads .bazelversion in the repository you’re in, then downloads and runs that Bazel release. Install it on your PATH under the name bazel:

Terminal window
version=v1.29.0
url=https://github.com/bazelbuild/bazelisk/releases/download/$version/bazelisk-linux-amd64
mkdir -p ~/.local/bin
curl -fsSL -o ~/.local/bin/bazelisk "$url"
echo "$(curl -fsSL "$url.sha256") $HOME/.local/bin/bazelisk" | sha256sum -c -
chmod +x ~/.local/bin/bazelisk
ln -sf bazelisk ~/.local/bin/bazel

Check it. Outside a repository this prints the latest Bazel release. Inside one, it prints the version pinned in .bazelversion:

Terminal window
bazel --version

From the root of any converted repository:

Terminal window
bazel build //... # build every cacheable output
bazel test //... # run every test Bazel knows about
bazel run //:assets # in a repository with generated files: install them,
# and run the steps that can't be cached

A repository that needs other tools (usually Node, for npm ci and its tests) pins them in shell.nix: run nix-shell at its root to get them. Its AGENTS.md says if anything must come first, such as npm ci. See Builds and CI.

Build only what you need by naming a target, for example bazel build //hymns:2026/psalm-119-he. Bazel works out what that target depends on and builds only that.

On Ubuntu, Bazel reports processwrapper-sandbox instead of linux-sandbox, because AppArmor restricts the user namespaces the Linux sandbox needs. That’s expected.

Nothing else needs to be installed. If a build seems to need a program from your machine’s PATH, that’s a bug in the build. Report it rather than installing the program.

Bazel reads the shared cache at https://bazel-cache.svrbc.org (each repository’s .bazelrc says so), so anything CI has already built comes down instead of being rebuilt. The summary line shows it: … remote cache hit.

For any SVRBC developer’s own machine (the Developer role or more in the svrbc group on GitLab), with full-disk encryption (see Builds and CI for what trusted means). These steps let it upload what it builds to the shared cache, with no AWS account. Every other machine stops at step 3.

4. Sign in to GitLab with glab, from nixpkgs. svrbc-mr and bazel-cache-sync use its token:

Terminal window
nix --extra-experimental-features 'nix-command flakes' profile add nixpkgs#glab
glab auth login --hostname gitlab.com # opens a browser tab to approve

5. Install bazel-cache-sync from this handbook’s repository (see Tools):

Terminal window
ln -sf ~/projects/developers.svrbc.org/tools/bazel-cache-sync ~/.local/bin/bazel-cache-sync

6. Upload after a build. Build as usual, then:

Terminal window
bazel-cache-sync --dry-run # what would go up
bazel-cache-sync

svrbc-mr does this for you before it pushes a merge request, after building and testing the commit, so its pipeline finds everything already done; it uploads only that build’s results. By hand, bazel-cache-sync uploads your whole disk cache, uncommitted experiments included, so prefer svrbc-mr. Every other machine trusts what you upload.

An administrator’s machine also signs in to AWS, which lets svrbc-mr plan infrastructure before it pushes (without it, the fork’s pipeline plans it).

Install the AWS CLI, from nixpkgs:

Terminal window
nix --extra-experimental-features 'nix-command flakes' profile add nixpkgs#awscli2
aws --version

Point it at the SVRBC access portal. Add this to ~/.aws/config (create the file if it doesn’t exist):

[sso-session svrbc]
sso_start_url = https://d-906661105f.awsapps.com/start
sso_region = us-east-1
sso_registration_scopes = sso:account:access
[profile svrbc]
sso_session = svrbc
sso_account_id = 991299033875
sso_role_name = AdministratorAccess
region = us-west-2

Then sign in. This opens a browser tab to approve, and lasts about a working day:

Terminal window
aws sso login --profile svrbc
aws sts get-caller-identity --profile svrbc # shows your user name
  • Builds and CI: why the setup looks like this, and the rules every repository follows.