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]
| Key | Type | Required | Description |
|---|---|---|---|
name | string | yes | Package name, must match its directory. |
category | string | yes | One of bootloader, kernel, softdevice, tool, library. |
version | string | yes | Semver string. Treated as opaque by the build. |
[supports]
Compatibility declarations. The build will refuse to run if the manifest’s board doesn’t match.
| Key | Type | Required | Description |
|---|---|---|---|
socs | string[] | no | List of compatible SoC keys, e.g. ["nrf52840"]. |
platforms | string[] | no | List of compatible platform keys. |
[source]
Where to clone the upstream source.
| Key | Type | Required | Description |
|---|---|---|---|
git | string | yes | Upstream repository URL. |
rev | string | yes | Pinned commit hash. |
submodules | string | no | One of none, shallow, recursive. |
[build]
How to actually build the package.
| Key | Type | Required | Description |
|---|---|---|---|
inputs | string[] | yes | Nix expressions evaluated under with pkgs;. |
command | string[] | yes | argv for the build command. {board} is substituted. |
outputs | string[] | yes | Globs of files to copy out of the sandbox. {board} is substituted. |
allow_unfree | bool | no | Required 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.