This is the example kiosk application for the following Nerves kiosk systems:
It runs a Phoenix LiveView web application full-screen on a Raspberry Pi using a Wayland compositor (Weston) and browser (Cog). The home screen shows system information, IP addresses, and links to a GPIO control page and Phoenix LiveDashboard.
The quickest way to try this out is with Nerves Burner. This downloads a pre-built firmware image and writes it to a MicroSD card without needing to compile anything.
-
Download Nerves Burner:
curl -L -o nerves_burner https://github.com/nerves-project/nerves_burner/releases/latest/download/nerves_burner chmod +x nerves_burner
-
Run it and follow the prompts to select Kiosk Demo, your target, and MicroSD card:
./nerves_burner
Installing fwup is recommended
for writing the MicroSD card. On macOS, run brew install fwup. If fwup isn't
available, Nerves Burner will provide alternative instructions.
If you'd like to customize the application or build from source:
git clone https://github.com/nerves-web-kiosk/kiosk_demo.git
cd kiosk_demo
export MIX_TARGET=rpi4 # or rpi5
mix setup
mix firmware
mix burnIf you want WiFi credentials to be written to the MicroSD card, initialize the MicroSD card like this instead:
NERVES_WIFI_SSID='access_point' NERVES_WIFI_PASSPHRASE='passphrase' mix burnYou can still change the WiFi credentials at runtime using
VintageNetWiFi.quick_configure/2, but this helps when you don't have an easy
alternative way of accessing the device to configure WiFi.
Then:
- Insert the MicroSD into your Raspberry Pi 4 or 5
- Connect your Pi to a display
- Boot it!
Connect over SSH to control the kiosk from the IEx console:
ssh kiosk@nerves-xxxx.local # password: "kiosk"You can run the Phoenix web app locally for development without hardware:
mix setup
mix phx.serverThen visit http://localhost:4000. Hardware-specific features like GPIO will not be functional on the host.
To change the screen orientation, use the method described below.
- Create
rootfs_overlay/etc/xdg/weston/weston.ini - Edit it like the following:
[output]
name=DSI-1
mode=720x1280@60.0
transform=rotate-270The transform key can be rotate-(90|180|270).
If you're looking at this section, but using an HDMI display, copy this instead:
[output]
name=HDMI-A-1
transform=rotate-270The original source is available here, but it's not very human-readable. For a more readable version, see this man page.