Skip to content

Commit 738e09d

Browse files
committed
add a Nerves guide
1 parent 7d2dd66 commit 738e09d

File tree

3 files changed

+97
-3
lines changed

3 files changed

+97
-3
lines changed

guides/getting_started.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Install the Scenic Archive like this
1515
mix archive.install hex scenic_new
1616
```
1717

18-
## Build the Starter App
18+
## Build the Basic App
1919

2020
First, navigate the command-line to the directory where you want to create your
2121
new Scenic app. Then run the following commands: (change `my_app` to the name
@@ -27,6 +27,20 @@ cd my_app
2727
mix do deps.get, scenic.run
2828
```
2929

30+
If you want to explore the more full-on example, then follow the instructions below.
31+
32+
## Build the Example App
33+
34+
First, navigate the command-line to the directory where you want to create your
35+
new Scenic app. Then run the following commands: (change `my_app` to the name
36+
of your app...)
37+
38+
```bash
39+
mix scenic.new.example my_app
40+
cd my_app
41+
mix do deps.get, scenic.run
42+
```
43+
3044
## Configure Scenic
3145

3246
In order to start Scenic, you should first build a configuration for one or more

guides/getting_started_nerves.md

Lines changed: 81 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,82 @@
1-
Placeholder for getting started with Nerves
1+
# Getting Started with [Nerves](https://nerves-project.org/)
22

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.

guides/welcome.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ If you are new to Scenic, then you should read the following guides.
1515
* [Install Dependencies](install_dependencies.html)
1616
* [General Overview](overview_general.html)
1717
* [Getting Started](getting_started.html)
18+
* [Getting Started with Nerves (IoT)](getting_started_nerves.html)
1819
* [Structure of a Scene](overview_scene.html)
1920
* [Life-cycle of a Scene](scene_lifecycle.html)
2021
* [Graph Overview](overview_graph.html)

0 commit comments

Comments
 (0)