Packages

Nerves System - Khadas VIM3 (Amlogic A311D)

Current section

Files

Jump to
Raw

mix.exs

defmodule NervesSystemVim3.MixProject do
use Mix.Project
@github_organization "your-username"
@app :nerves_system_vim3
@version "0.1.0"
def project do
[
app: @app,
version: @version,
elixir: "~> 1.11",
compilers: Mix.compilers() ++ [:nerves_package],
nerves_package: nerves_package(),
description: description(),
package: package(),
deps: deps(),
aliases: [loadconfig: [&bootstrap/1]],
docs: [extras: ["README.md"], main: "readme"],
preferred_cli_env: %{
docs: :docs,
"hex.build": :docs,
"hex.publish": :docs
},
nerves_runtime: [
config: [
kv_backend: {Nerves.Runtime.KVBackend.UBootEnv, []}
]
]
]
end
def application do
[]
end
defp bootstrap(args) do
set_target()
Application.start(:nerves_bootstrap)
Mix.Task.run("loadconfig", args)
end
defp nerves_package do
[
type: :system,
artifact_sites: [
{:github_releases, "#{@github_organization}/#{@app}"}
],
platform: Nerves.System.BR,
platform_config: [
defconfig: "nerves_defconfig"
],
checksum: package_files()
]
end
defp deps do
[
{:nerves, "~> 1.11", runtime: false},
{:nerves_system_br, "1.33.0", runtime: false},
{:nerves_toolchain_aarch64_nerves_linux_gnu, "~> 14.2.0", runtime: false},
{:nerves_system_linter, "~> 0.4", only: [:dev, :test], runtime: false},
{:ex_doc, "~> 0.22", only: [:dev, :docs], runtime: false}
]
end
defp description do
"""
Nerves System - Khadas VIM3 (Amlogic A311D)
"""
end
defp package do
[
files: package_files(),
licenses: ["Apache-2.0"],
links: %{"GitLab" => "https://gitlab.com/st8vrt/nerves_system_vim3"}
]
end
defp package_files do
[
"config",
"fwup.conf",
"fwup-revert.conf",
"LICENSE",
"mix.exs",
"nerves_defconfig",
"post-build.sh",
"post-createfs.sh",
"README.md",
"rootfs_overlay",
"scripts",
"uboot",
"linux",
"VERSION"
]
end
defp build_runner_opts() do
# Download source files first to get download errors right away.
[make_args: primary_site() ++ ["source", "all", "legal-info"]]
end
defp primary_site() do
case System.get_env("BR2_PRIMARY_SITE") do
nil -> []
primary_site -> ["BR2_PRIMARY_SITE=#{primary_site}"]
end
end
defp set_target() do
if function_exported?(Mix, :target, 1) do
apply(Mix, :target, [:vim3])
else
System.put_env("MIX_TARGET", "vim3")
end
end
end