DevNerves

A Mix task that creates Nerves projects with complete dev container setup, making Nerves development on Windows (and other platforms) smooth and hassle-free.

🎯 What is DevNerves?

DevNerves simplifies the tedious process of setting up a Nerves development environment, especially on Windows. It combines:

🚀 Features

📋 Prerequisites

Before installing DevNerves, ensure you have:

Windows Users

Enable host networking in Docker Desktop:

  1. Open Docker Desktop Settings
  2. Go to Resources → Network
  3. Check "Enable host networking"
  4. Click "Apply & Restart"

📦 Installation

Option 1: Install from Hex (Recommended)

mix archive.install hex dev_nerves

Option 2: Install from Source

git clone https://github.com/yourusername/dev_nerves.git
cd dev_nerves
mix do deps.get, archive.build, archive.install

🎮 Usage

Basic Usage

mix dev_nerves.new my_robot

This will:

  1. Launch an interactive setup wizard
  2. Ask you to select your target device
  3. Optionally configure WiFi
  4. Create a complete Nerves project with dev container setup

Advanced Usage

Skip the interactive prompts by providing options:

# Create project with specific target
mix dev_nerves.new my_robot --target rpi4

# Create with WiFi pre-configured
mix dev_nerves.new my_robot --target rpi4 --wifi-ssid "MyWiFi" --wifi-psk "password123"

# Short form
mix dev_nerves.new my_robot -t rpi3

Options

🎯 Supported Targets

DevNerves supports all officially supported Nerves targets:

Device Target Code Description
Raspberry Pi A+, B, B+ rpi BCM2835, 512MB RAM
Raspberry Pi Zero/Zero W rpi0 BCM2835, 512MB RAM
Raspberry Pi Zero 2W / 3A (64-bit) rpi0_2 BCM2837, 512MB RAM
Raspberry Pi 2 Model B rpi2 BCM2836, 1GB RAM
Raspberry Pi 3 Model B/B+ rpi3 BCM2837, 1GB RAM
Raspberry Pi Zero 2W / 3A (32-bit) rpi3a BCM2837, 512MB RAM
Raspberry Pi 4 Model B rpi4 BCM2711, 2-8GB RAM
Raspberry Pi 5 rpi5 BCM2712, 4-8GB RAM
BeagleBone Black/Green/Wireless, PocketBeagle bbb AM335x, 512MB RAM
Generic x86_64 x86_64 x86_64 architecture
OSD32MP1 osd32mp1 STM32MP157, 512MB RAM
GRiSP 2 grisp2 i.MX 6UL, 512MB RAM
MangoPi MQ Pro mangopi_mq_pro Allwinner D1, 1GB RAM

See Nerves Supported Targets for more details.

🛠️ What Gets Created

When you run mix dev_nerves.new my_robot, you get:

my_robot/
├── .devcontainer/
│   ├── devcontainer.json    # VS Code dev container config
│   ├── docker-compose.yml   # Docker Compose setup
│   └── Dockerfile           # Container with all Nerves tools
├── .ssh/
│   └── .gitkeep            # Mount point for SSH keys
├── config/                 # Nerves configuration
├── lib/                    # Your application code
├── test/                   # Tests
├── .gitignore             # Updated with dev container entries
├── FIRST_DEVICE.md        # Complete getting started guide
├── my_robot.code-workspace # VS Code workspace file
└── mix.exs                # Project configuration

🚀 Quick Start After Creation

After creating your project:

# 1. Open in VS Code
cd my_robot
code my_robot.code-workspace

# 2. Reopen in Container
# Press F1 → "Dev Containers: Reopen in Container"
# Wait for container to build (5-10 minutes first time)

# 3. Inside the container terminal:
mix deps.get
mix firmware

# 4. Burn to SD card (from host machine with Balena Etcher)
# Or use fwup on Linux/Mac

# 5. Boot your device and connect!
ssh nerves.local

For detailed instructions, see the auto-generated FIRST_DEVICE.md in your project!

📖 Documentation

Each created project includes a comprehensive FIRST_DEVICE.md guide covering:

🎨 Interactive UI with Owl

DevNerves uses the powerful Owl library by Mykola Konyk for beautiful CLI interactions:

Owl makes the CLI experience feel modern and professional, similar to tools like npm create or cargo new.

Example Interaction

╔═══════════════════════════════════════════════════╗
║  🚀 Nerves Dev Container Setup                   ║
║  Easy Nerves development for Windows users       ║
╚═══════════════════════════════════════════════════╝

📋 Configuration

Select your target device:

❯ Raspberry Pi 4 Model B - BCM2711, 2-8GB RAM
  Raspberry Pi 3 Model B/B+ - BCM2837, 1GB RAM
  Raspberry Pi Zero / Zero W - BCM2835, 512MB RAM
  Raspberry Pi 5 - BCM2712, 4-8GB RAM
  BeagleBone Black - AM335x, 512MB RAM

✓ Selected: rpi4

🐛 Troubleshooting

"mix: command not found"

Install Elixir first: https://elixir-lang.org/install.html

"nerves_bootstrap not found"

Install Nerves bootstrap:

mix archive.install hex nerves_bootstrap

Docker Container Won't Start

Can't Find Device on Network (Windows)

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Development

# Clone the repository
git clone https://github.com/yourusername/dev_nerves.git
cd dev_nerves

# Install dependencies
mix deps.get

# Run tests
mix test

# Build archive locally
mix archive.build

# Install locally for testing
mix archive.install

📚 Resources

📄 License

Apache License 2.0

🙏 Acknowledgments


Made with ❤️ for the Elixir and Nerves community