Nerves IoT framework, apparently popular with agents

Underjord is an artisanal consultancy doing consulting in Elixir, Nerves with an accidental speciality in marketing and outreach. If you like the writing you should really try the pro version.

I’ve been active in the Nerves community ever since 2019 when I made it control a small eInk display. It was and is a welcoming group of Elixir nerds and BEAM huggers that do fun stuff with hardware. This is also why I insist on gathering them at Goatmire Elixir. Some do it professionally, some for fun. What makes it nice for developers also seems to make it nice for agents. Or for edge AI startups. Or something. We see sneaky growth.

The trendline is all vibes unfortunately. I have no source to make science data. We’ve never had a good grasp on the amount of usage for Nerves because embedded industry usage doesn’t generally get talked about. It is either secret, sensitive or so deep in the stack as to be unknown. The culture is not the same as for web and cloud dev where people share a ton about what they do with what stack and how. When people do an industrial IoT Gateway they don’t share anything about it.

This is how I’ve randomly discovered a swedish company with 10.000 - 20.000 Nerves devices in production. I’ve worked with companies to migrate fleets of thousands of devices. We know Nerves has been put in airplane wifi, boat .. stuff, arcade machines, commercial NVRs, thermostats, building control systems, more thermostats. Probably an ultrasonic welder. We know the unknowables are out there as well since we occasionally get DMs or PRs from individuals clearly doing something industrial or commercial that we never hear about.

Solid foundations

The most important thing that Nerves offers is a strong foundation. A fairly minimal buildroot build with a set of best practices around A/B partition updates (think blue/green deploys for devices), firmware signing, disk encryption support, firmware deltas, integration with standard Elixir tooling and support for multiple hardware targets.

Then there is some stuff Nerves standardizes on that you could customize if you really wanted to or had to. Like storing some values in a uboot environment. Time management. Watchdog support. Deterministic builds. The list goes on.

Nerves doesn’t tell you what goes on the device but it sets you up to build that in a resilient high-level language. Elixir. It runs pretty lean on top of Linux in terms of resource use and it makes so many common tasks simple. Where you’d usually need to stand up many OS processes, some queues/broker/coordination points and then make sure those run reliably via some kind of supervisor .. with Elixir that’s already the architecture of the BEAM. Lots of decisions you don’t need to make that are proven to work.

Binary pattern matching makes implementing protocols and whatnot way simpler.

One sticking point people used to have is that porting a new board from whatever support was in buildroot or yocto for it to the buildroot approach Nerves uses and adding the Nerves bits on top could be quite the journey and you needed a lot of knowhow. This has very much changed with LLMs. I have an Orange Pi 5 Plus system I should bundle up and ship that was mostly built by Claude. We’ve seen community members bring up Android devices, new SBCs and so on en masse just because it is mostly mechanical repetitive work and testing. And most of the typing and most of the trawling of codebases can be done by the bot. Beyond that the weird accelerators and vendor specialty hardware on these boards is now way easier to put to use because doing custom code for your usage is relatively cheap. Hardware support was never a major blocker for professional usage, you just needed that one person who knew how to get there. This has completely changed. The onramp is much wider now and what hardware people can get going with has exploded as your agent can usually get you going.

Constraints

Agents without direction tend to be a bit all over the place. They risk having you run Raspberry Pi OS for your prototype that subsequently ships and then is honestly a pain to live with in production as SD cards fail and fragile install procedures shift due to package management. A Nerves build is locked down. And the language selection, tool selection and procedures are also all constrained. It removes entire conversations that are just about how to do a high quality hardware foundation layer. Nerves does most of that for you and you build your product from there.

Studies indicate that agents are kind of great at Elixir and I trust that far enough to say. It is not a hindrance that we aren’t doing Python or TypeScript. I’ve had it operate the device over an interactive iex prompt plenty and it does fine. My experimental nerves_mcp has been great for me to work with for giving the bot a good way to wait for a reboot and to easily run snippets. I’ve had the agent find a missing filesystem partition table (it was hidden in the device tree overlay for a vendor emmc driver). Fix BLE misbehaviours. Tune and optimize mmwave radar firmware.

I’ve also had it accientally re-encrypt my root filesystem on my actual computer with garbage data running things carelessly. Don’t get me wrong, these things are a complex topic and I expect the world to see some incredibly stupid security issues in the future.

A trustworthy core

Anyway, we see new companies picking up Nerves and just flying towards their goal on top of it. Most of them are too stealthy or fancy to show up in the Discord and say hi unfortunately. But we catch the traces and we are perfeclty happy to see people build on a good foundation. They don’t owe us a social call. We see a lot of potential upside with the increased agent use, we also see the load it places on us as the upstream. Nerves recently adopted additions to the contribution guidelines for agent usage. Mostly to ensure we don’t regress the quality of the project and/or drown in agent-driven PRs and issues. We prefer to talk to humans.

We see people experiment and innovate around the leaves of the tree with agents. And we try to keep the trunk changing quite mildly and with great consideration. That consideration, reliability and balance is what brought people to Nerves in the first place. We stay low risk and you can do your calculated risks on top.

An ecosystem

The Elixir ecosystem has a lot of cool stuff in it. Livebook plops into Nerves via nerves_livebook which is awesome for prototyping on hardware. Building web apps we have Phoenix LiveView which loses most of its drawbacks in an embedded context. So we have examples for that. And often people want that in a kiosk-style touch screen setup so we offer that. Both for Raspberry Pi 4, 5 and running on your host machine under qemu. Just check the kiosk_demo repo. Recently with a cooler screensaver implementation.

The fully open source NervesHub and the managed, hosted NervesCloud (free accounts for diy, prototyping and hobbyists) are the default OTA update platform for Nerves. It supports minimal delta updates, device health tracking, remote consoles and so much more. NervesHub grew up in the Nerves ecosystem and is currently growing support for more varieties of firmware. If you run non-BEAM Elixir or Erlang with AtomVM, Rust on microcontrollers or just want ESP32-IDF those all shipped recently. Rauc and more are inbound as well. Proven with hundreds of thousands of devices and no scaling limit in sight it is quite the offering.

I showed a lot of it in my the talk where the community donated 200 devices to me for fun.

In a fractured world like the embedded space building shared experience on common tools is very nice. You have things like alarmist and talks on the nuances of alarms and failure.

Hardware is still quite moaty

With SaaS becoming an ever more challenging proposition, the only moat really being existing scale or domain knowledge, a lot of companies seem to be looking at hardware a bit more. With apprehension because as we all know, it isn’t called easyware. Shipping hardware and being able to iterate efficiently on the firmware/software using good, safe update mechanisms is a heck of a thing. And agents are definitely helpful on top of Nerves.

Hardware is still a defensible moat.

My experience so far indicates that agents do better working within opinionated frames and frameworks. Constraining the embedded Linux portion to Nerves. Constraining the app layer to Elixir, or in the case of my usb_proxy device* I constrained the application layer to be Ash Framework. Less code, fewer valid options and the agents get a lot done in little time.

I don’t know what will happen to software, hardware or any firmness level inbetween. I have some hopes that the interest in the framework means that I can keep doing what I enjoy and so far that seems to be very true. My work in the Nerves core team, on NervesCloud and the Elixir ecosystem overall is a great joy. Getting to poke at hardware for a living is delightful.

If you have ideas about doing things with Linux and hardware, do try Nerves. If you need it without Linux do take a look at AtomVM which runs on MCUs. And if you want to go deep on this stuff, don’t miss this year’s Goatmire Elixir. One full day of hardware-oriented talks. 2 days of workshops. And lots more.

* The USB proxy is a neat firmware I can put on an RPi4 or similar. Build the firmware with a tailscale auth key baked in and then burn to an SD card and just start. It then allows me to let agents running in a VM in Finland mount and operate on USB devices that I plug into the Pi, access serial, do TFTP network booting and more. It has worked very well for isolating agents and still doing embedded work. I had it fully working in a couple of hours.

Underjord is an artisanal consultancy doing consulting in Elixir, Nerves with an accidental speciality in marketing and outreach. If you like the writing you should really try the pro version.

Note: Or try the videos on the YouTube channel.