Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Packages (package.toml)

A package is a single buildable component — a bootloader, a SoftDevice, a flashing helper, the kernel. Each package lives at packages/<name>/package.toml.

The build recipe is parameterized by the manifest’s board, so one package recipe builds for every compatible target.

Example

[package]
name     = "nrf52-adafruit-uf2-bootloader"
category = "bootloader"
version  = "0.10.0"

[supports]
socs = ["nrf52840"]

[source]
git        = "https://github.com/adafruit/Adafruit_nRF52_Bootloader.git"
rev        = "6180d8a26b8ca4c494158e4c5e9ca183f6801826"
submodules = "recursive"

[build]
inputs       = [
  "gcc-arm-embedded",
  "gnumake",
  "python3.withPackages (ps: [ ps.intelhex ])",
  "adafruit-nrfutil",
]
command      = ["make", "BOARD={board}", "all"]
allow_unfree = true
outputs      = ["_build/build-{board}/*.{uf2,hex,zip}"]

Sections

[package]

KeyTypeRequiredDescription
namestringyesPackage name, must match its directory.
categorystringyesOne of bootloader, kernel, softdevice, tool, library.
versionstringyesSemver string. Treated as opaque by the build.

[supports]

Compatibility declarations. The build will refuse to run if the manifest’s board doesn’t match.

KeyTypeRequiredDescription
socsstring[]noList of compatible SoC keys, e.g. ["nrf52840"].
platformsstring[]noList of compatible platform keys.

[source]

Where to clone the upstream source.

KeyTypeRequiredDescription
gitstringyesUpstream repository URL.
revstringyesPinned commit hash.
submodulesstringnoOne of none, shallow, recursive.

[build]

How to actually build the package.

KeyTypeRequiredDescription
inputsstring[]yesNix expressions evaluated under with pkgs;.
commandstring[]yesargv for the build command. {board} is substituted.
outputsstring[]yesGlobs of files to copy out of the sandbox. {board} is substituted.
allow_unfreeboolnoRequired if any input is unfree. Gated by workspace [policy].

inputs accepts bare attribute names (gcc-arm-embedded) and function calls (python3.withPackages (ps: [ ps.intelhex ])). {board} placeholders in command and outputs are substituted from the project manifest’s board field.