Bitcoin Guix Tag Builder
bgt is a tool to perform automated or semi-automated Guix builds of Bitcoin Core.
These can be manually initiated, or trigger when a new tag is detected via polling the GitHub API.
It can build, attest, and codesign tagged Bitcoin Core releases.
- You will need to install and setup Guix for Bitcoin Core by following Bitcoin Core's INSTALL.md.
- (optional) For attesting (signing) you will need a GPG key configured in your default keyring.
- You will need a fork of the bitcoin-core/guix.sigs repository.
- For pull requests to this repository, you will need your GPG key to be in the guix.sigs builder-keys which can be done via a pull request.
- (optional) To use
--automode (automatically open pull requests against guix.sigs) you will need a GitHub personal access token. Set it via theGITHUB_BGT_TOKENenvironment variable orgithub_tokenin the config file.- Classic token (recommended): The
public_reposcope is sufficient and allows creating PRs against upstream repos. - Fine-grained token: Not recommended - these tokens cannot create PRs on repos they don't have explicit access to, even for public repos.
- Classic token (recommended): The
To install bgt-builder, you need to have Rust and Cargo installed on your system. Then, you can install it either using Cargo:
cargo install bgtOr from source:
git clone https://github.com/bitcoin-dev-tools/bgt-builder.git bgt
cd bgt
cargo install --path .After installation, you can use the bgt command to interact with the tool.
To see the available commands run:
bgtRun the setup wizard to configure bgt:
bgt setupThis will guide you through setting up your GPG key short ID, signer name, and other necessary configurations.
Build a specific tag of Bitcoin Core:
bgt build <tag>Replace <tag> with the specific version tag you want to build, e.g., v27.1.
Attest to non-codesigned build outputs:
bgt attest <tag> [--auto]The --auto flag will automatically sign using GPG and open a PR on GitHub.
Attach codesignatures to existing non-codesigned outputs and attest:
bgt codesign <tag> [--auto]The --auto flag will automatically sign using GPG and open a PR on GitHub.
Run a continuous watcher to monitor for new tags and automatically build them:
bgt watch start [--auto] [--dry-run] [--log-file <PATH>]Where:
--autoautomatically signs using GPG and opens PRs on GitHub--dry-runmonitors for new tags without performing builds or signing--log-file <PATH>writes logs to the specified file instead of stderr
This command will poll the GitHub API for new tags and automatically build, attest, and codesign new releases.
To run in the background, use a process manager like systemd, supervisor, or tmux (see Running as a background service below).
Clean up Guix build directories while leaving caches intact:
bgt cleanView the current configuration settings:
bgt show-configGuix build current master to populate Guix caches:
bgt warmup--multi-package: UseJOBS=1 ADDITIONAL_GUIX_COMMON_FLAGS='--max-jobs=8'for building. This can be added to any command.--debug: Enable debug log level. This can be added to any command.
bgt uses environment variables for logging configuration. You can set the RUST_LOG environment variable to control the log level. For example:
RUST_LOG=debug bgt build v27.1This will run the build command with debug-level logging.
To run the watcher in the background, use a process manager. Here are some options:
Create a user service file at ~/.config/systemd/user/bgt-watch.service:
[Unit]
Description=BGT Bitcoin Guix Builder Watcher
After=network-online.target
Wants=network-online.target
[Service]
ExecStart=/path/to/bgt watch start --auto
Restart=on-failure
RestartSec=30
[Install]
WantedBy=default.targetThen enable and start it:
systemctl --user daemon-reload
systemctl --user enable bgt-watch
systemctl --user start bgt-watch
systemctl --user status bgt-watchView logs with:
journalctl --user -u bgt-watch -f# tmux
tmux new-session -d -s bgt 'bgt watch start --auto'
# screen
screen -dmS bgt bgt watch start --autoFor any method, you can use --log-file to write logs to a file:
bgt watch start --auto --log-file ~/.config/bgt/watch.logContributions to bgt are welcome! Please feel free to submit issues and pull requests on our GitHub repository.
See license.
- implement Guix building
- permit building a specified tag
- enable signing
- add advanced GPG signing solutions (tbd)
- remove some dependencies