# `Nerves.Env`
[🔗](https://github.com/nerves-project/nerves/blob/v1.14.1/lib/nerves/env.ex#L10)

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.

# `bootstrap`

```elixir
@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`

```elixir
@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`

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

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

# `data_dir`

```elixir
@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`

```elixir
@spec disable() :: :ok
```

Disable the Nerves Env compilers

# `download_dir`

```elixir
@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`

```elixir
@spec enable() :: :ok
```

Enable the Nerves Env compilers

# `enabled?`

```elixir
@spec enabled?() :: boolean()
```

Check if the env compilers are disabled

# `ensure_loaded`

```elixir
@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`

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

# `firmware_path`

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

The path to the firmware file

# `host_arch`

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

Returns the architecture for the host system.

## Example return values
  "x86_64"
  "arm"

# `host_os`

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

Returns the os for the host system.

## Example return values
  "win"
  "linux"
  "darwin"

# `images_path`

```elixir
@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?`

```elixir
@spec loaded?() :: boolean()
```

Check if the Nerves.Env is loaded

# `package`

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

Gets a package by app name.

# `packages`

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

Lists all Nerves packages loaded in the Nerves environment.

# `packages_by_type`

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

Lists packages by package type.

# `set_source_date_epoch`

```elixir
@spec set_source_date_epoch() :: :ok
```

# `system`

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

Helper function for returning the system type package

# `system_platform`

```elixir
@spec system_platform() :: module()
```

Helper function for returning the system_platform type package

# `toolchain`

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

Helper function for returning the toolchain type package

# `toolchain_platform`

```elixir
@spec toolchain_platform() :: atom()
```

Helper function for returning the toolchain_platform type package

---

*Consult [api-reference.md](api-reference.md) for complete listing*
