cffe353831
Flake lock file updates: • Updated input 'flake-parts': 'github:hercules-ci/flake-parts/9126214d0a59633752a136528f5f3b9aa8565b7d' (2024-04-01) → 'github:hercules-ci/flake-parts/4d34ce6412bc450b1d4208c953dc97c7fc764f1a' (2024-05-01) • Updated input 'nixpkgs': 'github:Nixos/nixpkgs/2bdd06e1d8e8b370a486251727f6ee6b059ff055' (2024-04-20) → 'github:Nixos/nixpkgs/23cc2b1f071baee1853de7d93df6167bdfe57aa6' (2024-05-01) • Updated input 'treefmt-nix': 'github:numtide/treefmt-nix/49dc4a92b02b8e68798abd99184f228243b6e3ac' (2024-04-01) → 'github:numtide/treefmt-nix/c6aaf729f34a36c445618580a9f95a48f5e4e03f' (2024-04-25) |
||
---|---|---|
.github | ||
bin | ||
buildbot_effects | ||
buildbot_nix | ||
examples | ||
nix | ||
.gitignore | ||
.mergify.yml | ||
default.nix | ||
flake.lock | ||
flake.nix | ||
pyproject.toml | ||
README.md |
Buildbot-nix
Buildbot-nix is a NixOS module designed to integrate Buildbot, a continuous integration (CI) framework, into the Nix ecosystem. This module is under active development, and while it's generally stable and widely used, please be aware that some APIs may change over time.
Getting Started with Buildbot Setup
To set up Buildbot using Buildbot-nix, you can start by exploring the provided examples:
- Check out the basic setup in example.
- Learn about configuring the Buildbot master in master module.
- Understand how to set up a Buildbot worker in worker module.
Additionally, you can find real-world examples at the end of this document.
Buildbot masters and workers can be deployed either on the same machine or on separate machines. To support multiple architectures, configure them as nix remote builders. For a practical NixOS example, see this remote builder configuration.
Using Buildbot in Your Project
Buildbot-nix automatically triggers builds for your project under these conditions:
- When a pull request is opened.
- When a commit is pushed to the default git branch.
It does this by evaluating the .#checks
attribute of your project's flake in
parallel. Each attribute found results in a separate build step. You can test
these builds locally using nix flake check -L
or
nix-fast-build.
If you need to build other parts of your flake, such as packages or NixOS
machines, you should re-export these into the .#checks
output. Here are two
examples to guide you:
- Using flake-parts.
- A plain flake example.
Integration with GitHub
Buildbot-nix primarily supports GitHub, with plans to extend support to other platforms like Gitea.
To integrate with GitHub:
- GitHub App: Set up a GitHub app for Buildbot to enable GitHub user authentication on the Buildbot dashboard.
- OAuth Credentials: After installing the app, generate OAuth credentials
and configure them in the buildbot-nix NixOS module. Set the callback url to
https://<your-domain>/auth/login
. - GitHub Token: Obtain a GitHub token with
admin:repo_hook
andrepo
permissions. For GitHub organizations, it's advisable to create a separate GitHub user for managing repository webhooks.
Binary caches
To access the build results on other machines there are two options at the moment
Local binary cache (harmonia)
You can set up a binary cache on your buildbot-worker machine to make its nix store accessible from other machines. Check out the README of the project, for an example configuration
Cachix
Buildbot-nix also supports pushing packages to cachix. Check out the comment out example configuration in our repository.
Real-World Deployments
See Buildbot-nix in action in these deployments:
- Nix-community infra: Configuration | Instance
- Mic92's dotfiles: Configuration | Instance
- Technical University Munich: Configuration | Instance
- Numtide: Instance