Skip to content
This repository was archived by the owner on Nov 27, 2025. It is now read-only.

Commit f6f4ca7

Browse files
committed
Upgraded to latest version of Nerves
1 parent a82fc25 commit f6f4ca7

File tree

5 files changed

+215
-157
lines changed

5 files changed

+215
-157
lines changed

config/config.exs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
1-
use Mix.Config
1+
import Config
2+
3+
Application.start(:nerves_bootstrap)
24

35
config :nerves, :firmware, rootfs_overlay: "rootfs_overlay"
6+
config :nerves, source_date_epoch: "1671295758"
47

5-
config :shoehorn,
6-
init: [:nerves_runtime, :nerves_init_gadget],
7-
app: Mix.Project.config()[:app]
8+
# config :shoehorn,
9+
# init: [:nerves_runtime, :nerves_init_gadget],
10+
# app: Mix.Project.config()[:app]
811

912
node_name = if Mix.env() != :prod, do: "kiwi"
1013

11-
config :nerves_init_gadget,
12-
ifname: "wlan0",
13-
address_method: :dhcpd,
14-
mdns_domain: "nerves.local",
15-
node_name: node_name,
16-
node_host: :mdns_domain
14+
# config :nerves_init_gadget,
15+
# ifname: "wlan0",
16+
# address_method: :dhcpd,
17+
# mdns_domain: "nerves.local",
18+
# node_name: node_name,
19+
# node_host: :mdns_domain
1720

1821
config :kiwi, Kiwi.Server,
1922
adapter: Plug.Cowboy,

config/host.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use Mix.Config
1+
import Config
22

33
config :logger,
44
level: :debug,

config/rpi0.exs

Lines changed: 74 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,87 @@
1-
use Mix.Config
1+
import Config
22

33
config :logger,
44
level: :debug,
55
backends: [RingLogger]
66

7+
config :shoehorn,
8+
init: [:nerves_runtime, :nerves_pack]
9+
10+
config :nerves,
11+
erlinit: [
12+
hostname_pattern: "nerves-%s"
13+
]
14+
715
config :nerves_time, :servers, [
8-
"0.pool.ntp.org",
9-
"1.pool.ntp.org",
10-
"2.pool.ntp.org",
11-
"3.pool.ntp.org"
16+
"0.pool.ntp.org",
17+
"1.pool.ntp.org",
18+
"2.pool.ntp.org",
19+
"3.pool.ntp.org"
1220
]
1321

1422
key_mgmt = System.get_env("NERVES_NETWORK_KEY_MGMT") || "WPA-PSK"
15-
config :nerves_network, :default,
16-
wlan0: [
17-
ssid: System.get_env("NERVES_NETWORK_SSID"),
18-
psk: System.get_env("NERVES_NETWORK_PSK"),
19-
key_mgmt: String.to_atom(key_mgmt)
20-
]
23+
config :vintage_net,
24+
regulatory_domain: "US",
25+
config: [
26+
{"usb0", %{type: VintageNetDirect}},
27+
{"eth0",
28+
%{
29+
type: VintageNetEthernet,
30+
ipv4: %{method: :dhcp}
31+
}},
32+
{"wlan0",
33+
%{
34+
type: VintageNetWiFi,
35+
vintage_net_wifi: %{
36+
networks: [
37+
key_mgmt: String.to_atom(key_mgmt),
38+
ssid: System.get_env("NERVES_NETWORK_SSID"),
39+
psk: System.get_env("NERVES_NETWORK_PSK")
40+
]
41+
},
42+
ipv4: %{method: :dhcp},
43+
}
44+
}
45+
]
46+
47+
config :mdns_lite,
48+
hosts: [:hostname, "nerves"],
49+
ttl: 120,
50+
51+
# Advertise the following services over mDNS.
52+
services: [
53+
%{
54+
protocol: "ssh",
55+
transport: "tcp",
56+
port: 22
57+
},
58+
%{
59+
protocol: "sftp-ssh",
60+
transport: "tcp",
61+
port: 22
62+
},
63+
%{
64+
protocol: "epmd",
65+
transport: "tcp",
66+
port: 4369
67+
}
68+
]
2169

2270
keys =
23-
[
24-
Path.join([System.user_home!(), ".ssh", "id_rsa.pub"]),
25-
Path.join([System.user_home!(), ".ssh", "id_ecdsa.pub"]),
26-
Path.join([System.user_home!(), ".ssh", "id_ed25519.pub"])
27-
]
28-
|> Enum.filter(&File.exists?/1)
71+
[
72+
Path.join([System.user_home!(), ".ssh", "id_rsa.pub"]),
73+
Path.join([System.user_home!(), ".ssh", "id_ecdsa.pub"]),
74+
Path.join([System.user_home!(), ".ssh", "id_ed25519.pub"])
75+
]
76+
|> Enum.filter(&File.exists?/1)
2977

3078
if keys == [],
31-
do:
32-
Mix.raise("""
33-
No SSH public keys found in ~/.ssh. An ssh authorized key is needed to
34-
log into the Nerves device and update firmware on it using ssh.
35-
See your project's config.exs for this error message.
36-
""")
37-
38-
config :nerves_firmware_ssh,
39-
authorized_keys: Enum.map(keys, &File.read!/1)
79+
do:
80+
Mix.raise("""
81+
No SSH public keys found in ~/.ssh. An ssh authorized key is needed to
82+
log into the Nerves device and update firmware on it using ssh.
83+
See your project's config.exs for this error message.
84+
""")
85+
86+
config :nerves_ssh,
87+
authorized_keys: Enum.map(keys, &File.read!/1)

mix.exs

Lines changed: 72 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,81 @@
11
defmodule Kiwi.MixProject do
2-
use Mix.Project
2+
use Mix.Project
33

4-
@app :kiwi
5-
@all_targets [:rpi, :rpi0, :rpi2, :rpi3, :rpi3a, :bbb, :x86_64]
4+
@app :kiwi
5+
@version "0.1.0"
6+
@all_targets [:rpi, :rpi0, :rpi2, :rpi3, :rpi3a, :rpi4]
67

7-
def project do
8-
[
9-
app: @app,
10-
version: "1.0.2",
11-
elixir: "~> 1.9",
12-
archives: [nerves_bootstrap: "~> 1.10"],
13-
start_permanent: Mix.env() == :prod,
14-
build_embedded: true,
15-
preferred_cli_target: [run: :host, test: :host],
16-
aliases: [loadconfig: [&bootstrap/1]],
17-
releases: [{@app, release()}],
18-
deps: deps()
19-
]
20-
end
8+
def project do
9+
[
10+
app: @app,
11+
version: @version,
12+
elixir: "~> 1.11",
13+
archives: [nerves_bootstrap: "~> 1.11"],
14+
start_permanent: Mix.env() == :prod,
15+
deps: deps(),
16+
releases: [{@app, release()}],
17+
preferred_cli_target: [run: :host, test: :host]
18+
]
19+
end
2120

22-
def bootstrap(args) do
23-
Application.start(:nerves_bootstrap)
24-
Mix.Task.run("loadconfig", args)
25-
end
21+
# Run "mix help compile.app" to learn about applications.
22+
def application do
23+
[
24+
mod: {Kiwi.Application, []},
25+
extra_applications: [:logger, :runtime_tools, :mnesia, :websockex]
26+
]
27+
end
2628

27-
def application do
28-
[
29-
mod: {Kiwi.Application, []},
30-
extra_applications: [:logger, :runtime_tools, :mnesia, :websockex],
31-
# included_applications: [:mnesia]
32-
]
33-
end
29+
# Run "mix help deps" to learn about dependencies.
30+
defp deps do
31+
[
32+
# Dependencies for all targets
33+
{:nerves, "~> 1.7.16 or ~> 1.8.0 or ~> 1.9.0", runtime: false},
34+
{:shoehorn, "~> 0.9.1"},
35+
{:ring_logger, "~> 0.8.5"},
36+
{:toolshed, "~> 0.2.26"},
37+
{:circuits_gpio, "~> 1.0"},
38+
{:circuits_spi, "~> 1.3"},
39+
{:circuits_i2c, "~> 1.1"},
40+
{:maru, "~> 0.14.0-pre.1"},
41+
{:plug_cowboy, "~> 2.6"},
42+
{:jason, "~> 1.4"},
43+
{:corsica, "~> 1.3"},
44+
{:mojito, "~> 0.7"},
45+
{:websockex, "~> 0.4"},
46+
{:nerves_time, "~> 0.4", targets: @all_targets},
3447

35-
def release do
36-
[
37-
overwrite: true,
38-
cookie: "#{@app}_cookie",
39-
include_erts: &Nerves.Release.erts/0,
40-
steps: [&Nerves.Release.init/1, :assemble],
41-
strip_beams: Mix.env() == :prod
42-
]
43-
end
44-
defp deps do
45-
[
46-
# Dependencies for all targets
47-
{:nerves, "~> 1.7", runtime: false},
48-
{:shoehorn, "~> 0.6"},
49-
{:ring_logger, "~> 0.6"},
50-
{:toolshed, "~> 0.2"},
51-
{:circuits_gpio, "~> 0.4"},
52-
{:circuits_spi, "~> 0.1"},
53-
{:circuits_i2c, "~> 0.3"},
54-
{:maru, "~> 0.14.0-pre.1"},
55-
{:plug_cowboy, "~> 2.0"},
56-
{:jason, "~> 1.1"},
57-
{:corsica, "~> 1.1"},
58-
{:mojito, "~> 0.2"},
59-
{:websockex, "~> 0.4"},
60-
{:nerves_time, "~> 0.2", targets: @all_targets},
48+
# Dependencies for all targets except :host
49+
{:nerves_runtime, "~> 0.13.0", targets: @all_targets},
50+
{:nerves_pack, "~> 0.7.0", targets: @all_targets},
6151

62-
# Dependencies for all targets except :host
63-
{:nerves_runtime, "~> 0.6", targets: @all_targets},
64-
{:nerves_init_gadget, "~> 0.4", targets: @all_targets},
52+
# Dependencies for specific targets
53+
# NOTE: It's generally low risk and recommended to follow minor version
54+
# bumps to Nerves systems. Since these include Linux kernel and Erlang
55+
# version updates, please review their release notes in case
56+
# changes to your application are needed.
57+
{:nerves_system_rpi, "~> 1.19", runtime: false, targets: :rpi},
58+
{:nerves_system_rpi0, "~> 1.19", runtime: false, targets: :rpi0},
59+
{:nerves_system_rpi2, "~> 1.19", runtime: false, targets: :rpi2},
60+
{:nerves_system_rpi3, "~> 1.19", runtime: false, targets: :rpi3},
61+
{:nerves_system_rpi3a, "~> 1.19", runtime: false, targets: :rpi3a},
62+
{:nerves_system_rpi4, "~> 1.19", runtime: false, targets: :rpi4},
63+
{:nerves_system_bbb, "~> 2.14", runtime: false, targets: :bbb},
64+
{:nerves_system_osd32mp1, "~> 0.10", runtime: false, targets: :osd32mp1},
65+
{:nerves_system_x86_64, "~> 1.19", runtime: false, targets: :x86_64},
66+
{:nerves_system_grisp2, "~> 0.3", runtime: false, targets: :grisp2}
67+
]
68+
end
6569

66-
# Dependencies for specific targets
67-
{:nerves_system_rpi, "~> 1.8", runtime: false, targets: :rpi},
68-
{:nerves_system_rpi0, "~> 1.8", runtime: false, targets: :rpi0},
69-
{:nerves_system_rpi2, "~> 1.8", runtime: false, targets: :rpi2},
70-
{:nerves_system_rpi3, "~> 1.8", runtime: false, targets: :rpi3},
71-
{:nerves_system_rpi3a, "~> 1.8", runtime: false, targets: :rpi3a},
72-
{:nerves_system_x86_64, "~> 1.8", runtime: false, targets: :x86_64},
73-
{:nerves_system_bbb, "~> 2.3", runtime: false, targets: :bbb},
74-
]
75-
end
70+
def release do
71+
[
72+
overwrite: true,
73+
# Erlang distribution is not started automatically.
74+
# See https://hexdocs.pm/nerves_pack/readme.html#erlang-distribution
75+
cookie: "#{@app}_cookie",
76+
include_erts: &Nerves.Release.erts/0,
77+
steps: [&Nerves.Release.init/1, :assemble],
78+
strip_beams: Mix.env() == :prod or [keep: ["Docs"]]
79+
]
80+
end
7681
end

0 commit comments

Comments
 (0)