|
1 |
| -Placeholder for getting started with Nerves |
| 1 | +# Getting Started with [Nerves](https://nerves-project.org/) |
2 | 2 |
|
3 |
| -Coming soon |
| 3 | +[Nerves](https://nerves-project.org/) is a tool chain that builds your application |
| 4 | +into a minimal boot image that you can use to run on devices such as the Raspberry Pi, |
| 5 | +BeagleBone Black, and many more. |
| 6 | + |
| 7 | +Scenic has everything you need to run on in this environment. In fact, this is the |
| 8 | +type of system that Scenic was made for! When built with Nerves, the boot-image (this |
| 9 | +includes Linux, Erlang, Elixir, Scenic, several fonts, etc) is on the order of 30Mb in |
| 10 | +size, which is a welcome relief. |
| 11 | + |
| 12 | +This guide assumes you have some familiarity with [Nerves](https://nerves-project.org/). |
| 13 | + |
| 14 | +## Install `scenic.new` |
| 15 | + |
| 16 | +The Scenic Archive is the home of the `scenic.new` mix task, which lays out a |
| 17 | +starter application for you. This is the easiest way to set up a new Scenic |
| 18 | +project. |
| 19 | + |
| 20 | +Install the Scenic Archive like this |
| 21 | + |
| 22 | +```bash |
| 23 | +mix archive.install hex scenic_new |
| 24 | +``` |
| 25 | + |
| 26 | +## Create the Basic Nerves App |
| 27 | + |
| 28 | +First, navigate the command-line to the directory where you want to create your |
| 29 | +new Scenic app. Then run the following commands: (change `my_app` to the name |
| 30 | +of your app...) |
| 31 | + |
| 32 | +```bash |
| 33 | +mix scenic.new.nerves my_app |
| 34 | +cd my_app |
| 35 | +``` |
| 36 | + |
| 37 | +At this point you have a choice. Do you want to build it locally to run on your |
| 38 | +dev machine (device specific things won't be there or need to be emulated), or |
| 39 | +do you want to build a boot image |
| 40 | + |
| 41 | +## Build and Run on Your Dev Machine |
| 42 | + |
| 43 | +The first time you build a nerves app, you need to set the `MIX_TARGET`, which tells |
| 44 | +it where you intend to run your app. Then you can install the dependencies. Do that on the command line like this: |
| 45 | + |
| 46 | +```bash |
| 47 | +export MIX_TARGET=host |
| 48 | +mix deps.get |
| 49 | +``` |
| 50 | + |
| 51 | +Then you can run the app on your dev machine the same way you would a non-nervs app. |
| 52 | + |
| 53 | +```bash |
| 54 | +mix scenic.run |
| 55 | +``` |
| 56 | + |
| 57 | +## Build and Run on a Raspberry Pi 3 |
| 58 | + |
| 59 | +The first time you build a nerves app, you need to set the `MIX_TARGET`, which tells |
| 60 | +it where you intend to run your app. Then you can install the dependencies. When targeting |
| 61 | +an embedded device, you will also need to create a release file. |
| 62 | + |
| 63 | +Do that on the command line like this: |
| 64 | + |
| 65 | +```bash |
| 66 | +export MIX_TARGET=rpi3 |
| 67 | +mix deps.get |
| 68 | +mix compile |
| 69 | +mix nerves.release.init |
| 70 | +``` |
| 71 | + |
| 72 | +Then you can build the boot image and burn it to your micro-SD card. |
| 73 | + |
| 74 | +```bash |
| 75 | +mix firmware.burn |
| 76 | +``` |
| 77 | + |
| 78 | +## What to read next? |
| 79 | + |
| 80 | +Next, you should read about the [structure of a scene](overview_scene.html). |
| 81 | +This will explain the parts of a scene, how to send and receive messages and how |
| 82 | +to push the graph to the ViewPort. |
0 commit comments