|
| 1 | +import Config |
| 2 | + |
| 3 | +# Use shoehorn to start the main application. See the shoehorn |
| 4 | +# docs for separating out critical OTP applications such as those |
| 5 | +# involved with firmware updates. |
| 6 | + |
| 7 | +config :shoehorn, |
| 8 | + init: [:nerves_runtime, :nerves_pack], |
| 9 | + app: Mix.Project.config()[:app] |
| 10 | + |
| 11 | +# Nerves Runtime can enumerate hardware devices and send notifications via |
| 12 | +# SystemRegistry. This slows down startup and not many programs make use of |
| 13 | +# this feature. |
| 14 | + |
| 15 | +config :nerves_runtime, :kernel, use_system_registry: false |
| 16 | + |
| 17 | +# Erlinit can be configured without a rootfs_overlay. See |
| 18 | +# https://github.com/nerves-project/erlinit/ for more information on |
| 19 | +# configuring erlinit. |
| 20 | + |
| 21 | +config :nerves, |
| 22 | + erlinit: [ |
| 23 | + hostname_pattern: "nerves-%s" |
| 24 | + ] |
| 25 | + |
| 26 | +# Configure the device for SSH IEx prompt access and firmware updates |
| 27 | +# |
| 28 | +# * See https://hexdocs.pm/nerves_ssh/readme.html for general SSH configuration |
| 29 | +# * See https://hexdocs.pm/ssh_subsystem_fwup/readme.html for firmware updates |
| 30 | + |
| 31 | +keys = |
| 32 | + [ |
| 33 | + Path.join([System.user_home!(), ".ssh", "id_rsa.pub"]), |
| 34 | + Path.join([System.user_home!(), ".ssh", "id_ecdsa.pub"]), |
| 35 | + Path.join([System.user_home!(), ".ssh", "id_ed25519.pub"]) |
| 36 | + ] |
| 37 | + |> Enum.filter(&File.exists?/1) |
| 38 | + |
| 39 | +if keys == [], |
| 40 | + do: |
| 41 | + Mix.raise(""" |
| 42 | + No SSH public keys found in ~/.ssh. An ssh authorized key is needed to |
| 43 | + log into the Nerves device and update firmware on it using ssh. |
| 44 | + See your project's config.exs for this error message. |
| 45 | + """) |
| 46 | + |
| 47 | +config :nerves_ssh, |
| 48 | + authorized_keys: Enum.map(keys, &File.read!/1) |
| 49 | + |
| 50 | +# Configure the network using vintage_net |
| 51 | +# See https://github.com/nerves-networking/vintage_net for more information |
| 52 | +config :vintage_net, |
| 53 | + regulatory_domain: "US", |
| 54 | + config: [ |
| 55 | + {"usb0", %{type: VintageNetDirect}}, |
| 56 | + {"eth0", |
| 57 | + %{ |
| 58 | + type: VintageNetEthernet, |
| 59 | + ipv4: %{method: :dhcp} |
| 60 | + }}, |
| 61 | + {"wlan0", %{type: VintageNetWiFi}} |
| 62 | + ] |
| 63 | + |
| 64 | +config :mdns_lite, |
| 65 | + # The `host` key specifies what hostnames mdns_lite advertises. `:hostname` |
| 66 | + # advertises the device's hostname.local. For the official Nerves systems, this |
| 67 | + # is "nerves-<4 digit serial#>.local". mdns_lite also advertises |
| 68 | + # "nerves.local" for convenience. If more than one Nerves device is on the |
| 69 | + # network, delete "nerves" from the list. |
| 70 | + |
| 71 | + host: [:hostname, "nerves"], |
| 72 | + ttl: 120, |
| 73 | + |
| 74 | + # Advertise the following services over mDNS. |
| 75 | + services: [ |
| 76 | + %{ |
| 77 | + name: "SSH Remote Login Protocol", |
| 78 | + protocol: "ssh", |
| 79 | + transport: "tcp", |
| 80 | + port: 22 |
| 81 | + }, |
| 82 | + %{ |
| 83 | + name: "Secure File Transfer Protocol over SSH", |
| 84 | + protocol: "sftp-ssh", |
| 85 | + transport: "tcp", |
| 86 | + port: 22 |
| 87 | + }, |
| 88 | + %{ |
| 89 | + name: "Erlang Port Mapper Daemon", |
| 90 | + protocol: "epmd", |
| 91 | + transport: "tcp", |
| 92 | + port: 4369 |
| 93 | + } |
| 94 | + ] |
| 95 | + |
| 96 | +# Import target specific config. This must remain at the bottom |
| 97 | +# of this file so it overrides the configuration defined above. |
| 98 | +# Uncomment to use target specific configurations |
| 99 | + |
| 100 | +# import_config "#{Mix.target()}.exs" |
0 commit comments