Botanix is a VCS agnostic CI system aiming to replicate Buildkite experience with Nix native primitives.
Find a file
adouard d14bec0f5a FIX: .gitignore to ignore proto files generate
Signed-off-by: adouard <alexandre.douard@ens-lyon.fr>
2025-12-28 02:50:14 +00:00
nix FIX: elaborate on the workerPackages description 2025-11-14 01:06:41 +01:00
packaging ADD: packaging systemd (socket + service) + env 2025-11-19 07:29:45 +00:00
proto ADD: botanix-cli with db connexion + protocol 2025-12-27 03:44:18 +00:00
src RM: proto file generated by prost during compil 2025-12-28 02:48:45 +00:00
.gitignore FIX: .gitignore to ignore proto files generate 2025-12-28 02:50:14 +00:00
AUTHORS.md ADD: initial commit : main + cli parser + env config + errors 2025-10-17 01:02:04 +02:00
build.rs ADD: botanix-cli with db connexion + protocol 2025-12-27 03:44:18 +00:00
Cargo.lock ADD: botanix-cli with db connexion + protocol 2025-12-27 03:44:18 +00:00
Cargo.toml ADD: botanix-cli with db connexion + protocol 2025-12-27 03:44:18 +00:00
LICENSE.md ADD: LICENSE.md 2025-11-14 23:24:15 +00:00
README.md ADD: Checkout priority order doc 2025-11-15 04:23:11 +00:00

Botanix

A distributed CI/CD system for Nix projects with webhook integration for Git forges.

Overview

Botanix is coordinator-worker system that builds Nix derivations in response to Git webhooks.

Quick Start

Prerequisites

  • Rust (lastest stable)
  • Nix with flakes enabled

Start the coordinator (Server)

export WEBHOOK_SECRET='YOUR_WEBHOOK_SECRET'
export FORGEJO_API='https://your-forge.example.com/api/v1/'
export FORGEJO_TOKEN='your_personal_access_token'
cargo run -- --mode server

Start a Worker

First you need a WORKER_TOKEN. You can obtain one by registering with coordinator:

curl -s -X POST YOUR_COORDINATOR_URL:YOUR_PORT/worker/register \
    -H 'Content-Type: application/json' \
    -d '{"systems":[SYSTEM_OF_YOUR_WORKER]}'

Now you can start the worker with the obtained token:

export COORDINATOR_URL='YOUR_COORDINATOR_URL'
export WORKER_TOKEN='YOUR_WORKER_TOKEN_GET_IN_THE_LAST_STEP'
cargo run -- --mode worker

Configure a Webhook

Add a webhook to your Git repository, for now available PROVIDER are { forgejo }

  • URL: http://your-server:8080/webhooks/PROVIDER
  • SECRET: Same as WEBHOOK_SECRET
  • EVENTS: Push events, Pull Request events.

Configuration

Server

  • Required:

    • WEBHOOK_SECRET: HMAC secret for validating webhooks
    • NIX_SYSTEMS: Comma separated systems this server supports (default: x86_64-linux).
  • Optional:

    • FORGEJO_API: Forgejo API base URL for status updates.
    • FORGEJO_TOKEN: Personal Acess Token for Forgejo API.
    • PORT: Coordinator http Port, (default: 8080)
    • GRPC_PORT: Coordinator gRPC Port, (default: 50051)

Worker

  • Required:

    • COORDINATOR_URL: Coordinator server base URL
    • WORKER_TOKEN: Authentication token.
    • NIX_SYSTEMS: Comma separated systems this worker supports (default: x86_64-linux).
  • Optional:

    • CACHE_URL: Nix binary cache URL for substitutions.
    • CACHE_NETRC_PATH: Path to .netrc file for authenticated cache access.
    • CHECKOUT_DIR: Directory to store git checkouts (default: follows systemd hierarchy).

Checkout Directory configuration

The worker stores cloned git repositories in a checkout directory. By default, this directory is determined in the following order:

Priority order:

  1. CHECKOUT_DIR environment variable (if set by the user).
  2. $RUNTIME_DIRECTORY/botanix/checkouts (if RUNTIME_DIRECTORY is set, typically by systemd).
  3. $TMPDIR/botanix/checkouts (if TMPDIR is set).
  4. /tmp/botanix/checkouts (default fallback).