Files
regent/doc/dev/development.md
raucao e9f587c43a Require REGENT_BUILD_HOST instead of defaulting to a specific machine
The wrapper fell back to one hard-coded build host when the variable was
unset, so it silently only worked on that one machine. It now exits with a
clear message pointing at the variable, and the dev doc marks it required
(REGENT_REPO_PATH keeps its `~/src/regent` default).
2026-11-29 22:55:26 +04:00

5.6 KiB

Development

How to build Regent, run it from a build tree, and test it.

Scope: local setup, building, running, tests and deployment. For running the signer unattended and pairing a client from the command line, see Advanced usage.

Prerequisites

You will need the following things properly installed on your computer.

  • Rust (cargo)
  • Meson and Ninja
  • GTK 4 and libadwaita development headers
  • blueprint-compiler
  • appstreamcli and desktop-file-validate (for the validation commands below)
  • nak (optional; only for the relay-level tests and the acceptance script)

On Arch Linux:

pacman -S rust meson ninja gtk4 libadwaita blueprint-compiler appstream

Building

cargo generate-lockfile          # once, so --locked builds work
meson setup _build
meson compile -C _build
meson install -C _build          # optional; needs to write to /usr/local

Run it from the build directory (GSETTINGS_SCHEMA_DIR is needed because the schema is not installed system-wide yet; REGENT_GRESOURCE points at the generated GResource):

GSETTINGS_SCHEMA_DIR=_build/data \
REGENT_GRESOURCE=_build/data/resources/org.kosmos.raucao.Regent.gresource \
  ./_build/regent

Nightly (development) build

A development build is a separate application identity — the app id carries a .Devel suffix, so the desktop file, icon, GSettings schema, GResource bundle, D-Bus name and data directories all follow, and the binary is regent-devel. That lets it install and run beside the stable one:

meson setup _build -Dprofile=development
meson compile -C _build
GSETTINGS_SCHEMA_DIR=_build/data \
REGENT_GRESOURCE=_build/data/resources/org.kosmos.raucao.Regent.Devel.gresource \
  ./_build/regent-devel

The nightly uses the banded nightly app icon and libadwaita's striped devel header bar, so it is obvious at a glance which build you are looking at.

Cargo is driven by Meson (custom_target). Every source file must be listed as an input in meson.build, otherwise edits don't trigger a rebuild.

Testing

The unit and integration tests run on a plain cargo test:

cargo test

The relay-level nak_* tests are ignored by default and need a real relay. Each spins up its own local nak serve, and together they cover the NIP-46 approval paths end to end:

CARGO_TARGET_DIR=_build/cargo-target REGENT_TEST_RELAY=wss://nostr.kosmos.org \
  cargo test --release -- --ignored --nocapture nak

There is also a full end-to-end check (vault → responder → app) in a throwaway HOME, using gtk4-broadwayd and nak:

dbus-run-session -- build-aux/acceptance.sh

Validating the package metadata

appstreamcli validate --no-net _build/data/org.kosmos.raucao.Regent.metainfo.xml
desktop-file-validate _build/data/org.kosmos.raucao.Regent.desktop
glib-compile-schemas --strict --dry-run _build/data/

Deploying to another machine

If you build on one machine and run on another — a fast build host and the desktop you test on — two helper scripts move a build across. build-aux/deploy-dev.sh runs on the build host; build-aux/regent-deploy.sh runs on the machine you test on. The test machine pulls the build over SSH, so neither side has to listen for inbound connections. You need SSH from the test machine to the build host.

Install the wrapper once, on the test machine:

mkdir -p ~/.local/bin
ssh BUILD_HOST 'cat PATH/TO/regent/build-aux/regent-deploy.sh' > ~/.local/bin/regent-deploy
chmod +x ~/.local/bin/regent-deploy

Then point it at your build host and repository path — either export them or edit the script:

export REGENT_BUILD_HOST=user@build-host     # required
export REGENT_REPO_PATH='~/src/regent'       # default: ~/src/regent

After every change, on the test machine:

regent-deploy

It asks the build host which GTK/libadwaita it builds against and warns if the two machines have drifted (a mismatch surfaces later as a symbol lookup error), pulls the install tree, unpacks it into ~/.local (no root needed), recompiles the GSettings schema, and prints the version it installed. The wrapper keeps itself current — it fetches its own copy from the build host and re-execs if it changed, so the one-time install above never goes stale (REGENT_DEPLOY_NO_UPDATE=1 skips that; the previous copy is kept as regent-deploy.bak).

Options:

  • REGENT_DEPLOY_PKG=1 regent-deploy — build and install a real regent-git package instead (asks for sudo).
  • REGENT_PROFILE=development regent-deploy — install the nightly .Devel identity instead; it has its own app id, desktop file and data directories, so it runs beside a stable install rather than replacing it.

Directly on the build host, with no test machine:

build-aux/deploy-dev.sh              # write a tarball to /tmp/regent-dev/
build-aux/deploy-dev.sh --emit       # stream the install tree to stdout
build-aux/deploy-dev.sh --pkg        # build the regent-git pacman package
build-aux/deploy-dev.sh --versions   # GTK/libadwaita this host builds against
build-aux/deploy-dev.sh --help

Further reading