> For the complete documentation index, see [llms.txt](https://docs.nerves-hub.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nerves-hub.org/1.0.0/nerves-key/nerves-integration.md).

# Nerves integration

Nerves can use the serial number programmed into the NervesKey for the hostname. This can come in handy for finding devices on the network since the hostname can be reported via DHCP or broadcast using mDNS.

{% hint style="info" %}
The DHCP client for Nerves reports hostnames to the DHCP server. Some DHCP servers like dnsmasq-based ones register those names with a colocated DNS server so that requests of that name return the IP address of the Nerves-based device. Many DHCP servers do not do this, so mDNS is the only option for easily finding the device.
{% endhint %}

In Nerves, the `boardid` program reads serial numbers off of boards. It has options to support many different kinds of hardware. To have it read the serial number off the NervesKey, add a `rootfs_overlay/etc/boardid.conf` file to your Nerves project. This will override the `boardid.conf` distributed with your Nerves system (assuming that you're using an official Nerves system). The contents should be:

```
# /etc/boardid.conf

-b nerves_key -f /dev/i2c-1
```

If your NervesKey is attached via a different I2C bus, update the `-f` option accordingly.

If this doesn't work, you can test `boardid` at the IEx prompt using the Toolshed `cmd` helper (or `System.cmd/3` if not using Toolshed) by running:

```elixir
iex> cmd("boardid -b nerves_key -f /dev/i2c-1 -b force -f failed")
abc123
```

The `-b force -f failed` part ensures that `boardid` doesn't fall back to try to find a serial number based on options in a `/etc/boardid.conf` file. Run `boardid --help` for more information.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.nerves-hub.org/1.0.0/nerves-key/nerves-integration.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
