Skip to content

Commit

Permalink
Update distribution example to latest
Browse files Browse the repository at this point in the history
  • Loading branch information
fhunleth committed Jul 29, 2023
1 parent 4bedb7f commit 812b7d1
Show file tree
Hide file tree
Showing 9 changed files with 91 additions and 85 deletions.
2 changes: 1 addition & 1 deletion hello_distribution/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Once connected, you can use Phoenix PubSub to send messages back and forth on th
on one device:

```elixir
iex(hello@nerves-bea0.local)3> Phoenix.PubSub.subscribe(HelloDistribution.PubSub, "test-event")
iex(hello@nerves-bea0.local)3> Phoenix.PubSub.subscribe(HelloDistribution.PubSub, "test-event")
```

and the other:
Expand Down
6 changes: 3 additions & 3 deletions hello_distribution/config/config.exs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
# This file is responsible for configuring your application and its
# dependencies.
#
# This configuration file is loaded before any dependency and
# is restricted to this project.
Expand All @@ -26,7 +26,7 @@ config :nerves, source_date_epoch: "1630590634"

config :logger, backends: [RingLogger]

if Mix.target() == :host or Mix.target() == :"" do
if Mix.target() == :host do
import_config "host.exs"
else
import_config "target.exs"
Expand Down
15 changes: 2 additions & 13 deletions hello_distribution/config/target.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,13 @@ import Config
# docs for separating out critical OTP applications such as those
# involved with firmware updates.

config :shoehorn,
init: [:nerves_runtime, :nerves_pack],
app: Mix.Project.config()[:app]

# Nerves Runtime can enumerate hardware devices and send notifications via
# SystemRegistry. This slows down startup and not many programs make use of
# this feature.

config :nerves_runtime, :kernel, use_system_registry: false
config :shoehorn, init: [:nerves_runtime, :nerves_pack]

# Erlinit can be configured without a rootfs_overlay. See
# https://github.com/nerves-project/erlinit/ for more information on
# configuring erlinit.

config :nerves,
erlinit: [
hostname_pattern: "nerves-%s"
]
config :nerves, :erlinit, update_clock: true

# Configure the device for SSH IEx prompt access and firmware updates
#
Expand Down
33 changes: 23 additions & 10 deletions hello_distribution/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,19 @@ defmodule HelloDistribution.MixProject do

@app :hello_distribution
@version "0.1.0"
@all_targets [:rpi, :rpi0, :rpi2, :rpi3, :rpi3a, :rpi4, :bbb, :osd32mp1, :x86_64]
@all_targets [
:rpi,
:rpi0,
:rpi2,
:rpi3,
:rpi3a,
:rpi4,
:bbb,
:osd32mp1,
:x86_64,
:grisp2,
:mangopi_mq_pro
]

def project do
[
Expand All @@ -12,7 +24,6 @@ defmodule HelloDistribution.MixProject do
elixir: "~> 1.9",
archives: [nerves_bootstrap: "~> 1.10"],
start_permanent: Mix.env() == :prod,
build_embedded: true,
deps: deps(),
releases: [{@app, release()}],
preferred_cli_target: [run: :host, test: :host]
Expand All @@ -31,17 +42,17 @@ defmodule HelloDistribution.MixProject do
defp deps do
[
# Dependencies for all targets
{:nerves, "~> 1.7.0", runtime: false},
{:shoehorn, "~> 0.7.0"},
{:ring_logger, "~> 0.8.1"},
{:toolshed, "~> 0.2.13"},
{:nerves, "~> 1.10", runtime: false},
{:shoehorn, "~> 0.9.0"},
{:ring_logger, "~> 0.10.2"},
{:toolshed, "~> 0.3.1"},
{:phoenix_pubsub, "~> 2.0"},

# Dependencies for all targets except :host
{:nerves_runtime, "~> 0.11.3", targets: @all_targets},
{:nerves_runtime, "~> 0.13.0", targets: @all_targets},
{:vintage_net_wizard, "~> 0.2", targets: @all_targets},
{:nerves_pack, "~> 0.5.0", targets: @all_targets},
{:circuits_gpio, "~> 0.4.8", targets: @all_targets},
{:nerves_pack, "~> 0.7.0", targets: @all_targets},
{:circuits_gpio, "~> 1.0", targets: @all_targets},
{:mdns_lite, "~> 0.8", targets: @all_targets},

# Dependencies for specific targets
Expand All @@ -53,7 +64,9 @@ defmodule HelloDistribution.MixProject do
{:nerves_system_rpi4, "~> 1.13", runtime: false, targets: :rpi4},
{:nerves_system_bbb, "~> 2.8", runtime: false, targets: :bbb},
{:nerves_system_osd32mp1, "~> 0.4", runtime: false, targets: :osd32mp1},
{:nerves_system_x86_64, "~> 1.13", runtime: false, targets: :x86_64}
{:nerves_system_x86_64, "~> 1.13", runtime: false, targets: :x86_64},
{:nerves_system_grisp2, "~> 0.3", runtime: false, targets: :grisp2},
{:nerves_system_mangopi_mq_pro, "~> 0.4", runtime: false, targets: :mangopi_mq_pro}
]
end

Expand Down
103 changes: 55 additions & 48 deletions hello_distribution/mix.lock

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion hello_distribution/rel/vm.args.eex
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
## See http://erlang.org/doc/system_principles/system_principles.html#code-loading-strategy
-mode embedded

# Load code as per the boot script since not using archives
# See https://www.erlang.org/doc/man/init.html#command-line-flags
-code_path_choice strict

## Disable scheduler busy wait to reduce idle CPU usage and avoid delaying
## other OS processes. See http://erlang.org/doc/man/erl.html#+sbwt
+sbwt none
Expand All @@ -34,7 +38,8 @@
## Start the Elixir shell

-noshell
-user Elixir.IEx.CLI
-user elixir
-run elixir start_iex

## Enable colors in the shell
-elixir ansi_enabled true
Expand Down
8 changes: 0 additions & 8 deletions hello_distribution/test/hello_distribution_test.exs

This file was deleted.

1 change: 0 additions & 1 deletion hello_distribution/test/test_helper.exs

This file was deleted.

1 change: 1 addition & 0 deletions scripts/projects.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ TARGETS="rpi0 rpi rpi2 rpi3 rpi3a rpi4 bbb x86_64 osd32mp1 mangopi_mq_pro"
ELIXIR_PROJECTS="blinky \
hello_gpio \
minimal \
hello_distribution \
hello_phoenix/firmware \
hello_live_view \
hello_wifi \
Expand Down

0 comments on commit 812b7d1

Please sign in to comment.