Skip to content

Commit 1df661d

Browse files
Mic92mergify[bot]
authored andcommitted
Improve readme
Improve readme
1 parent f56e432 commit 1df661d

File tree

2 files changed

+70
-18
lines changed

2 files changed

+70
-18
lines changed

README.md

Lines changed: 66 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,78 @@
11
# Buildbot-nix
22

3-
A nixos module to make [buildbot](https://www.buildbot.net/) a proper Nix-CI.
3+
Buildbot-nix is a NixOS module designed to integrate
4+
[Buildbot](https://www.buildbot.net/), a continuous integration (CI) framework,
5+
into the Nix ecosystem. This module is under active development, and while it's
6+
generally stable and widely used, please be aware that some APIs may change over
7+
time.
48

5-
For an example checkout the [example](./examples/default.nix) and the module
6-
descriptions for [master](./nix/master.nix) and [worker](./nix/worker.nix).
9+
## Getting Started with Buildbot Setup
710

8-
This project is still in early stage and many APIs might change over time.
11+
To set up Buildbot using Buildbot-nix, you can start by exploring the provided
12+
examples:
913

10-
## Github
14+
- Check out the basic setup in [example](./examples/default.nix).
15+
- Learn about configuring the Buildbot master in
16+
[master module](./nix/master.nix).
17+
- Understand how to set up a Buildbot worker in
18+
[worker module](./nix/worker.nix).
1119

12-
We currently primarly support Github as a platform but we are also looking into
13-
supporting other CIs such as gitea.
20+
Additionally, you can find real-world examples at the end of this document.
1421

15-
Buildbot requires a GitHub app, to allow login for GitHub users to its
16-
dashboard. After installing the app, create oauth credentials and set them in
17-
the buildbot-nix nixos module.
22+
Buildbot masters and workers can be deployed either on the same machine or on
23+
separate machines. To support multiple architectures, configure them as
24+
[nix remote builders](https://nixos.org/manual/nix/stable/advanced-topics/distributed-builds).
25+
For a practical NixOS example, see
26+
[this remote builder configuration](https://github.com/Mic92/dotfiles/blob/main/nixos/eve/modules/remote-builder.nix).
1827

19-
Furthermore buildbot requires a github token with the following permissions:
28+
## Using Buildbot in Your Project
2029

21-
- `admin:repo_hook`, `repo`
30+
Buildbot-nix automatically triggers builds for your project under these
31+
conditions:
2232

23-
For github organisations it's recommend to create an additional GitHub user for
24-
that.
33+
- When a pull request is opened.
34+
- When a commit is pushed to the default git branch.
2535

26-
## Real-worlds deployments
36+
It does this by evaluating the `.#checks` attribute of your project's flake in
37+
parallel. Each attribute found results in a separate build step. You can test
38+
these builds locally using `nix flake check -L` or
39+
[nix-fast-build](https://github.com/Mic92/nix-fast-build).
2740

28-
- [Nix-community infra](https://github.com/nix-community/infra/tree/master/modules/nixos)
29-
- [Mic92's dotfiles](https://github.com/Mic92/dotfiles/blob/main/nixos/eve/modules/buildbot.nix)
30-
- [Technical University Munich](https://github.com/TUM-DSE/doctor-cluster-config/tree/master/modules/buildbot)
41+
If you need to build other parts of your flake, such as packages or NixOS
42+
machines, you should re-export these into the `.#checks` output. Here are two
43+
examples to guide you:
44+
45+
- Using
46+
[flake-parts](https://github.com/Mic92/dotfiles/blob/10890601a02f843b49fe686d7bc19cb66a04e3d7/flake.nix#L139).
47+
- A
48+
[plain flake example](https://github.com/nix-community/nixos-images/blob/56b52791312edeade1e6bd853ce56c778f363d50/flake.nix#L53).
49+
50+
### Integration with GitHub
51+
52+
Buildbot-nix primarily supports GitHub, with plans to extend support to other
53+
platforms like Gitea.
54+
55+
To integrate with GitHub:
56+
57+
1. **GitHub App**: Set up a GitHub app for Buildbot to enable GitHub user
58+
authentication on the Buildbot dashboard.
59+
2. **OAuth Credentials**: After installing the app, generate OAuth credentials
60+
and configure them in the buildbot-nix NixOS module.
61+
3. **GitHub Token**: Obtain a GitHub token with `admin:repo_hook` and `repo`
62+
permissions. For GitHub organizations, it's advisable to create a separate
63+
GitHub user for managing repository webhooks.
64+
65+
### Real-World Deployments
66+
67+
See Buildbot-nix in action in these deployments:
68+
69+
- **Nix-community infra**:
70+
[Configuration](https://github.com/nix-community/infra/tree/master/modules/nixos)
71+
| [Instance](https://buildbot.nix-community.org/)
72+
- **Mic92's dotfiles**:
73+
[Configuration](https://github.com/Mic92/dotfiles/blob/main/nixos/eve/modules/buildbot.nix)
74+
| [Instance](https://buildbot.thalheim.io/)
75+
- **Technical University Munich**:
76+
[Configuration](https://github.com/TUM-DSE/doctor-cluster-config/tree/master/modules/buildbot)
77+
| [Instance](https://buildbot.dse.in.tum.de/)
78+
- **Numtide**: [Instance](https://buildbot.numtide.com)

examples/default.nix

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ in
3535
oauthId = "aaaaaaaaaaaaaaaaaaaa";
3636
user = "mic92-buildbot";
3737
admins = [ "Mic92" ];
38+
# All github projects with this topic will be added to buildbot.
39+
# One can trigger a project scan by visiting the Builds -> Builders page and looking for the "reload-github-project" builder.
40+
# This builder has a "Update Github Projects" button that everyone in the github organization can use.
41+
topic = "buildbot-mic92";
3842
};
3943
# optional expose latest store path as text file
4044
# outputsPath = "/var/www/buildbot/nix-outputs";

0 commit comments

Comments
 (0)