Nerves.Env (nerves v1.11.3)

View Source

Contains package info for Nerves dependencies

The Nerves Env is used to load information from dependencies that have nerves config. Nerves loads this config because it needs access to information about Nerves compile time dependencies before any code is compiled.

Summary

Functions

Export environment variables used by Elixir, Erlang, C/C++ and other tools so that they use Nerves toolchain parameters and not the host's.

Re evaluates the mix file under a different target.

Cleans the artifacts for the package build_runners of all specified packages.

The location for storing global nerves data.

Disable the Nerves Env compilers

The download location for artifact downloads.

Enable the Nerves Env compilers

Check if the env compilers are disabled

Return the Nerves package config for the specified application

The path to the firmware file

Returns the architecture for the host system.

Returns the os for the host system.

The path to where firmware build files are stored This can be overridden in a Mix project by setting the :images_path key.

Check if the Nerves.Env is loaded

Gets a package by app name.

Lists all Nerves packages loaded in the Nerves environment.

Lists packages by package type.

Helper function for returning the system type package

Helper function for returning the system_platform type package

Helper function for returning the toolchain type package

Helper function for returning the toolchain_platform type package

Functions

bootstrap()

@spec bootstrap() :: :ok

Export environment variables used by Elixir, Erlang, C/C++ and other tools so that they use Nerves toolchain parameters and not the host's.

For a comprehensive list of environment variables, see the documentation for the package defining system_platform.

change_target(target)

@spec change_target(String.t()) :: :ok

Re evaluates the mix file under a different target.

This allows you to start in one target, like host, but then switch to a different target.

clean(pkgs)

@spec clean([Nerves.Package.t()]) :: :ok

Cleans the artifacts for the package build_runners of all specified packages.

data_dir()

@spec data_dir() :: path :: String.t()

The location for storing global nerves data.

The base directory is normally set by the XDG_DATA_HOME environment variable (i.e. $XDG_DATA_HOME/nerves/). If XDG_DATA_HOME is unset, the user's home directory is used (i.e. $HOME/.nerves).

disable()

@spec disable() :: :ok

Disable the Nerves Env compilers

download_dir()

@spec download_dir() :: path :: String.t()

The download location for artifact downloads.

Placing an artifact tar in this location will bypass the need for it to be downloaded.

enable()

@spec enable() :: :ok

Enable the Nerves Env compilers

enabled?()

@spec enabled?() :: boolean()

Check if the env compilers are disabled

ensure_loaded(app, path \\ nil)

@spec ensure_loaded(app :: atom(), path :: String.t() | nil) ::
  {:ok, Nerves.Package.t()} | {:error, term()}

Return the Nerves package config for the specified application

Options

  • app - The atom of the app to load
  • path - Optional path for the app

export_package_env(package)

@spec export_package_env(Nerves.Package.t()) :: :ok

firmware_path(config \\ mix_config())

@spec firmware_path(keyword()) :: String.t()

The path to the firmware file

host_arch()

@spec host_arch() :: String.t()

Returns the architecture for the host system.

Example return values

"x86_64" "arm"

host_os()

@spec host_os() :: String.t()

Returns the os for the host system.

Example return values

"win" "linux" "darwin"

images_path(config \\ mix_config())

@spec images_path(keyword()) :: String.t()

The path to where firmware build files are stored This can be overridden in a Mix project by setting the :images_path key.

images_path: "/some/other/location"

Defaults to (build_path)/nerves/images

loaded?()

@spec loaded?() :: boolean()

Check if the Nerves.Env is loaded

package(name)

@spec package(name :: atom()) :: Nerves.Package.t() | nil

Gets a package by app name.

packages()

@spec packages() :: [Nerves.Package.t()]

Lists all Nerves packages loaded in the Nerves environment.

packages_by_type(type, packages \\ nil)

@spec packages_by_type(type :: atom(), [Nerves.Package.t()] | nil) :: [
  Nerves.Package.t()
]

Lists packages by package type.

set_source_date_epoch()

@spec set_source_date_epoch() :: :ok

system()

@spec system() :: Nerves.Package.t() | nil

Helper function for returning the system type package

system_platform()

@spec system_platform() :: module()

Helper function for returning the system_platform type package

toolchain()

@spec toolchain() :: Nerves.Package.t() | nil

Helper function for returning the toolchain type package

toolchain_platform()

@spec toolchain_platform() :: atom()

Helper function for returning the toolchain_platform type package