# `NBPR.Package`
[🔗](https://github.com/jimsynz/nbpr/blob/v0.7.0/lib/nbpr/package.ex#L1)

Metadata struct describing an NBPR package.

Returned by the generated `__nbpr_package__/0` callback on every module that
does `use NBPR.BrPackage`. The struct is the canonical introspection surface
for the curated CI, the build runner, and any future tooling.

# `artifact_site`

```elixir
@type artifact_site() ::
  {:github_releases, String.t()} | {:ghcr, String.t()} | {:oci, String.t()}
```

# `libc`

```elixir
@type libc() :: :gnu | :musl
```

The C library a Nerves system's toolchain targets. Nerves systems are
overwhelmingly glibc; `x86_64` is the musl one.

# `t`

```elixir
@type t() :: %NBPR.Package{
  artifact_sites: [artifact_site()],
  br_external_path: String.t() | nil,
  br_package: String.t() | nil,
  build_opt_extensions: %{required(atom()) =&gt; map()},
  build_opts: keyword(),
  daemons: [NBPR.Package.Daemon.t()],
  description: String.t(),
  homepage: String.t() | nil,
  kernel_modules: [String.t()],
  module: module(),
  name: atom(),
  runtime_env: [{String.t(), String.t()}],
  unsupported_libc: [libc()],
  upstream_version: String.t() | nil,
  version: pos_integer()
}
```

# `br_name`

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

The Buildroot package name, for a mainline package or a vendored one.

A mainline package names it, because the name that Buildroot knows and the name
that Hex knows are not always the same: `bluez-alsa` is `nbpr_bluez_alsa` here,
and Hex takes no hyphen. **A vendored package is named by its own NBPR name**,
because the external tree is ours and the two names have no reason to differ.

    iex> NBPR.Package.br_name(%NBPR.Package{name: :bluez_alsa, br_package: "bluez-alsa"})
    "bluez-alsa"

    iex> NBPR.Package.br_name(%NBPR.Package{name: :librespot, br_external_path: "buildroot"})
    "librespot"

# `external_tree`

```elixir
@spec external_tree(t()) :: Path.t() | nil
```

The absolute path of a vendored package's Buildroot external tree.

**`br_external_path` is relative to the package's `priv` directory.** A Hex
package ships `priv`, so the tree travels with the package and it is there at
build time whether the package came from Hex or from the workspace.

It returns `nil` for a mainline package.

# `vendored?`

```elixir
@spec vendored?(t()) :: boolean()
```

Whether this package brings its own Buildroot tree.

---

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