A small demo application built with Emerge and Solve for Nerves. It renders
a simple animated UI over DRM and wires button presses into a counter
controller.
- Elixir
~> 1.19 - One of the supported Nerves targets:
rpi4orrpi5 - At least one SSH public key in
~/.ssh, required for target builds byconfig/target.exs
mix deps.get
iex -S mixThis starts the app on the host using the Wayland backend from
config/host.exs.
export MIX_TARGET=rpi5
mix firmwarerpi4 should also work, but it is not currently tested and may require a
different drm_card value in lib/nerves_emerge_demo.ex and/or some changes to the nerves_system.
To bake WiFi settings into the firmware image with mise, put them in the
git-ignored mise.local.toml before building:
[env]
NERVES_WIFI_SSID = "your-ssid"
NERVES_WIFI_PSK = "your-passphrase"
NERVES_REGULATORY_DOMAIN = "US"Then build firmware with an explicit target:
export MIX_TARGET=rpi5
mix firmwareIf you are not using mise, you can still export the vars in your shell:
export MIX_TARGET=rpi5
export NERVES_WIFI_SSID="your-ssid"
export NERVES_WIFI_PSK="your-passphrase"
export NERVES_REGULATORY_DOMAIN="US"
mix firmwareNERVES_WIFI_SSID and NERVES_WIFI_PSK are read from config/target.exs
during the build. WIFI_SSID, WIFI_PSK, WIFI_COUNTRY_CODE, and
WIFI_REGULATORY_DOMAIN are also accepted as fallback names. If no PSK is set,
the network is treated as open.
mix test- The viewport renders an animated background and two counter rows.
- Pressing
+and-dispatchesSolveevents to the counter controller. - The displayed count updates from the exposed state in
NervesEmergeDemo.State.
lib/nerves_emerge_demo.ex is the viewport entrypoint. It mounts the app and
renders the UI with Emerge.
lib/nerves_emerge_demo/state.ex defines the top-level Solve app and wires in
the counter controller.
lib/nerves_emerge_demo/counter_controller.ex owns the increment and decrement
event handlers.
lib/nerves_emerge_demo/application.ex starts the state process and viewport
under the supervision tree.
- host mode uses the Wayland backend
- target mode uses the DRM backend
rootfs_overlay/etc/iex.exsenablesToolshedin the target IEx session
Licensed under the Apache License, Version 2.0. See LICENSE.