I am frustrated by this topic… I want my nerves project to set the hostname of the burned device to be based upon the build targets. The core issue that, yes, if I know my cpu serial number, my device will receive a hostname something like nerves-xxxx, but I don’t want to think of my project as “nerves” followed by some essentially random, value. I want my hostname to be myproject-rpi0, and myproject-rpi3, because I am going to have multiple instance on the same network.
All of the advice I find via, AI tools, keep offering advice which eventually boils down to copy the rootfs-overlay and then change it. But I don’t believe that will work, because different runtime targets will have different rootfs-overlays. (At least I assume they might) so there is no correct definitive one to copy.
Besides, that seems like utter overkill, to just set the hostname.
Here is the NERVES banner when I ssh in
████▄▄ ▐███
█▌ ▀▀██▄▄ ▐█
█▌ ▄▄ ▀▀ ▐█ N E R V E S
█▌ ▀▀██▄▄ ▐█
███▌ ▀▀████
breadboard 0.1.0 - nose-bar (921e63ce-a45f-58a0-74ec-42e986107784)
Serial : BB-RPI0
Uptime : 25.567 seconds
Clock : 2026-03-13 20:34:14 UTC (unsynchronized)
Firmware : Valid (A) Applications : 41 started
Memory usage : 43 MB (14%) Part usage : 0 MB (0%)
Load average : 0.19 0.05 0.02 Temperature : 41.2°C
Hostname : nerves-rpi0 Platform : rpi0 arm
wlan0 : 192.168.5.197/22, fd1f:b439:205c:4f5c:ba27:ebff:fe50:5b27/64, fd9c:eabc:d71f:1:ba27:ebff:fe50:5b27/64, fe80::ba27:ebff:fe50:5b27/64
usb0 : 172.31.43.141/30
Nerves CLI help: IEx with Nerves — nerves v1.13.1
Toolshed imported. Run h(Toolshed) for more info.
I want the hostname here, and the one that is announced of mdns, to allow ssh into the device, to be configurable. And configurable via a template that references config values, or env variables.
Can this be done?