-
-
Notifications
You must be signed in to change notification settings - Fork 20
/
mix.exs
174 lines (161 loc) · 5.12 KB
/
mix.exs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
defmodule VintageNet.MixProject do
use Mix.Project
@version "0.13.5"
@source_url "https://github.com/nerves-networking/vintage_net"
def project do
[
app: :vintage_net,
version: @version,
elixir: "~> 1.13",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
compilers: [:elixir_make | Mix.compilers()],
make_targets: ["all"],
make_clean: ["mix_clean"],
make_error_message: "",
deps: deps(),
dialyzer: dialyzer(),
docs: docs(),
package: package(),
description: description(),
aliases: [compile: [&check_deps/1, "compile"]],
preferred_cli_env: %{
docs: :docs,
"hex.publish": :docs,
"hex.build": :docs,
credo: :test
}
]
end
def application do
[
env: [
config: [],
max_interface_count: 8,
tmpdir: "/tmp/vintage_net",
path: "/usr/sbin:/usr/bin:/sbin:/bin",
udhcpc_handler: VintageNet.Interface.Udhcpc,
udhcpd_handler: VintageNet.Interface.Udhcpd,
resolvconf: "/etc/resolv.conf",
persistence: VintageNet.Persistence.FlatFile,
persistence_dir: "/root/vintage_net",
persistence_secret: "obfuscate_things",
# List of reliable hosts used to check Internet connectivity
# Use IP addresses and port numbers here rather than names.
internet_host_list: [
# Cloudflare DNS over TCP
{{1, 1, 1, 1}, 53},
# Google public DNS over TCP
{{8, 8, 8, 8}, 53},
# OpenDNS
{{208, 67, 222, 222}, 53},
# Quad9
{{9, 9, 9, 9}, 53},
# Neustar
{{156, 154, 70, 5}, 53}
],
regulatory_domain: "00",
# Contain processes in cgroups by setting to:
# [cgroup_base: "vintage_net", cgroup_controllers: ["cpu"]]
muontrap_options: [],
power_managers: [],
route_metric_fun: &VintageNet.Route.DefaultMetric.compute_metric/2
],
extra_applications: [:logger, :crypto],
mod: {VintageNet.Application, []}
]
end
defp elixirc_paths(:test), do: ["lib", "test/support"]
defp elixirc_paths(_), do: ["lib"]
defp description do
"Network configuration and management for Nerves"
end
defp package do
%{
files: [
"lib",
"mix.exs",
"Makefile",
"README.md",
"docs/cookbook.md",
"src/*.[ch]",
"src/test-c99.sh",
"LICENSE",
"CHANGELOG.md"
],
licenses: ["Apache-2.0"],
links: %{"GitHub" => @source_url}
}
end
defp deps do
[
# Runtime dependencies
{:beam_notify, "~> 1.0 or ~> 0.2.0"},
{:gen_state_machine, "~> 2.0.0 or ~> 2.1.0 or ~> 3.0.0"},
{:muontrap, "~> 1.0 or ~> 0.5.1 or ~> 0.6.0"},
{:property_table, "~> 0.2.0"},
# Build dependencies
{:credo, "~> 1.2", only: :test, runtime: false},
{:credo_binary_patterns, "~> 0.2.2", only: :test, runtime: false},
{:dialyxir, "~> 1.1", only: :dev, runtime: false},
{:elixir_make, "~> 0.6", runtime: false},
{:ex_doc, "~> 0.22", only: :docs, runtime: false}
]
end
defp dialyzer() do
[
flags: [:missing_return, :extra_return, :unmatched_returns, :error_handling, :underspecs],
list_unused_filters: true,
plt_file: {:no_warn, "_build/plts/dialyzer.plt"}
]
end
defp docs do
[
before_closing_body_tag: &before_closing_body_tag/1,
extras: ["README.md", "docs/cookbook.md", "CHANGELOG.md"],
main: "readme",
logo: "assets/vintage_net-notext.png",
assets: %{"assets" => "assets"},
source_ref: "v#{@version}",
source_url: @source_url,
skip_undefined_reference_warnings_on: ["CHANGELOG.md"]
]
end
defp before_closing_body_tag(:html) do
"""
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/mermaid.min.js"></script>
<script>
document.addEventListener("DOMContentLoaded", function () {
mermaid.initialize({ startOnLoad: false });
let id = 0;
for (const codeEl of document.querySelectorAll("pre code.mermaid")) {
const preEl = codeEl.parentElement;
const graphDefinition = codeEl.textContent;
const graphEl = document.createElement("div");
const graphId = "mermaid-graph-" + id++;
mermaid.render(graphId, graphDefinition, function (svgSource, bindListeners) {
graphEl.innerHTML = svgSource;
bindListeners && bindListeners(graphEl);
preEl.insertAdjacentElement("afterend", graphEl);
preEl.remove();
});
}
});
</script>
"""
end
defp before_closing_body_tag(_), do: ""
defp check_deps(_) do
for bad_dep <- [:nerves_init_gadget, :nerves_network] do
Mix.Project.in_project(bad_dep, "/tmp", fn module ->
if module do
Mix.raise("""
vintage_net is incompatible with #{inspect(bad_dep)}.
Please remove #{inspect(bad_dep)} from your project's mix dependencies. See
https://hexdocs.pm/vintage_net/readme.html#installation for help.
""")
end
end)
end
end
end