Behaviour for the different ways NBPR can produce a per-package Buildroot artefact.
A backend takes a spec/0 (patched BR tree, output dir, rendered defconfig,
BR package name, build env, extra mounts) and returns the harvest dir — the
directory containing per-package/<br_package>/{target,staging,legal-info},
ready for NBPR.Buildroot.Harvest.harvest!/2.
Current backends, tried in order by select/0:
NBPR.Buildroot.Backend.Shell— nativemakeon the host. Only usable inside the Nerves canonical build env (mix nerves.system.shell), where the toolchain wrappers, sysroot paths, and ABI flags already match.NBPR.Buildroot.Backend.Docker/NBPR.Buildroot.Backend.Podman— run the build insideghcr.io/nerves-project/nerves_system_br:latestvia a shared container runner (NBPR.Buildroot.Backend.Container). This is the everywhere-else path, including non-Linux hosts.
Adding a new style of builder (e.g. Apple's container, a Windows runtime) is
a matter of implementing this behaviour and listing it in @backends.
Overriding the choice
Set NBPR_BUILD_BACKEND to a backend's short name (shell, docker,
podman) to force that backend, bypassing the auto-detect ordering. This is
handy when more than one runtime is present (e.g. force podman when docker
would otherwise win) or to force a native build outside the canonical env. The
chosen backend's build!/1 still fails loudly if it genuinely can't run.
Summary
Callbacks
Whether this backend can run in the current environment.
Builds the artefact described by spec and returns the harvest dir
(containing per-package/<br_package>/).
Types
Callbacks
Functions
@spec select() :: module()
Returns the backend to use.
Honours a NBPR_BUILD_BACKEND override if set (see the module docs);
otherwise returns the first backend that can run in the current environment.
Raises with guidance if the override is unknown or no backend is available.