nerves_hub_link downloads the archive, verifies its signature, and hands your application the path. What happens to the file after that is up to your code.
Requirements
How delivery works
- NervesHub offers a device the archive when the device connects, when its deployment group gets a release with a different archive, and when the device or its group membership changes.
- A device is only offered the archive of its group’s current release, and only while it runs that release’s firmware. A device still on older firmware gets the archive on the connection after it has updated.
- A device with updates turned off, or in the penalty box, is not offered archives. A device in device-managed mode is.
- On the device,
nerves_hub_linkchecks it holds a public key, then callsarchive_available/1. - If your code returns
:download, the file is downloaded and verified withfwup. On successarchive_ready/2is called with the path.
Set it up
1
Handle archives in your Client
The default Client ignores archives. Override both callbacks in your Client module:
MyApp.Archives stands for your own code. It has to unpack the file, use its contents, and remember the UUID so the archive is not downloaded again. nerves_hub_link does not delete the file for you.2
Make sure the device has verification keys
If your firmware already sets
fwup_public_keys, archives are verified with those keys and there is nothing to do. See Signing keys for the other options.3
Build the archive
An archive is a The result is a ZIP file with
.fw file made with fwup. NervesHub requires the meta-product, meta-platform, meta-architecture and meta-version metadata, and meta-version must be a valid SemVer version. fwup adds meta-uuid itself.A minimal archive.conf that packages one file:meta.conf and your file under data/.4
Sign and upload it
nh checks the metadata, signs the archive with fwup, and uploads it to the current product. The key options are the same as for firmware: --key, --key-file, --password, the NERVES_HUB_PRIVATE_KEY environment variable, and --skip-signing for a file that is already signed.You can also upload in the web UI. Open the product’s Archives page and click Upload archive, or drop the file on the page. The file must already be signed.NervesHub refuses an archive that is not signed by one of your organization’s keys.5
Attach it to a release
In the web UI, open the deployment group and click New release. Pick the archive in the Archive field, then click Create release. The field starts on the current release’s archive.With A release made with
nh:nh deployment release create has no archive unless you pass --archive, whatever the previous release had. To add an archive while keeping the current firmware, run nh deployment update <group> --archive <archive-uuid>, which creates a new release.A release’s archive cannot be changed after the release is made.Check that it works
- On the product’s Archives page, the Delivered by column shows which deployment groups have the archive in their current release.
- Open the archive to see Deployment groups delivering it and Releases with this archive.
- On the device, the log shows
[NervesHubLink] Archive Download completeonce the download finishes, followed by yourarchive_ready/2running. - NervesHub writes an audit log entry for the device when it sends an archive after a change, though not for the offer made on every connect.
Archive could not be validated, your public signing keys maybe be incorrectly configured, the signature did not match any key the device holds. archive_ready/2 is not called.
Callbacks
archive_available/1
Called with a NervesHubLink.Message.ArchiveInfo struct:
Return one of:
archive_ready/2
Called with the same struct and the path of the verified file. The file is stored at <data_path>/archives/<file name>, where data_path defaults to /data/nerves-hub. Return :ok.
Signing keys
Archives are verified with their own key list,archive_public_keys. nerves_hub_link picks the keys in this order:
- If
request_archive_public_keysistrue, it asks NervesHub for keys when it connects. - Otherwise, if
archive_public_keyshas entries, it uses those. - Otherwise, if
fwup_public_keyshas entries, it uses those. - Otherwise, it asks NervesHub for keys when it connects.
nerves_hub_link 2.13.0, a device with no usable archive key refuses the archive without calling archive_available/1. It logs Refusing archive : no public keys are available to verify the archive signature.
Limits
- One archive per release.
- An archive is downloaded with the same downloader and retry settings as firmware. It is written straight to a file. The updater strategies do not apply.
- There is no progress report to NervesHub for archive downloads.
nhhas no command to delete an archive. Delete archives from the archive’s page in the web UI.

