# Precompiled v0.5.1 - Table of Contents

> Install signed precompiled dependency builds instead of compiling them

## Pages

- [Precompiled](readme.md)
- [Changelog](changelog.md)

- Getting started
  - [Setup](setup.md)
  - [Nerves](nerves.md)
  - [On a device](device.md)

- Reference
  - [Configuration](configuration.md)
  - [What matches](matching.md)

- Explanation
  - [Trust](trust.md)

- Troubleshooting
  - [Troubleshooting](troubleshooting.md)
  - [Known limitations](limitations.md)

## Modules

- [Precompiled](Precompiled.md): Installs signed precompiled libraries into a running Nerves device, with
no Mix, no Hex and no compiler.
- [Precompiled.Config](Precompiled.Config.md): The client's configuration. The source defaults to the official API,
`https://compatibility.nerves-project.org/api/precompiled`, checked
against the root this library ships; `config :precompiled, source: url`
and `root: path` replace them, and `content: [url]` adds mirrors, in the
project's config only: no option, call or environment variable can,
since a source or mirror learns which dependencies a project has and a
root decides whose builds it runs.
`except: [dep, ...]` skips dependencies; `Precompiled.Host.install/2`
takes `:except` and `:home` as options.
- [Precompiled.Elf](Precompiled.Elf.md): A bounded reader for the parts of an ELF file that decide whether a
target build runs on another release of the same Nerves system: the
file's class, machine and type, its `DT_NEEDED` libraries and `DT_SONAME`,
the symbol versions it needs from each library (`.gnu.version_r`) and the
ones it defines (`.gnu.version_d`). A precompiled NIF built against one
release can be installed on another when every library it needs is there
and defines every version it asks for.
- [Precompiled.Env](Precompiled.Env.md): What the two places the client runs answer differently: a Mix project at
build time (`Precompiled.Env.MixProject`) and the project
`Mix.install/2` keeps on a device (`Precompiled.Env.MixInstall`).
Everything else in the client is shared.

- [Precompiled.Fetch](Precompiled.Fetch.md): Bytes in, verified files in the project's `_build` out. Manifests are checked against
the hash the batch names; files against the hash the manifest names,
before anything reaches the build directory. Install is atomic per
dependency: staged under `_build/<t>/lib/.precompiled/<dep>.<os pid>-<n>`
(one dir per install), renamed into place with Mix's "already compiled"
marker.

- [Precompiled.Host](Precompiled.Host.md): Install signed, verified precompiled dependency builds instead of
compiling them.
- [Precompiled.Installed](Precompiled.Installed.md): One app `Precompiled.install/2` installed, or one `Precompiled.list/1`
found in the store.
- [Precompiled.Match](Precompiled.Match.md): The key: when a precompiled build may stand in for a local compile. Pure
functions over the project's lock, the manifest entry and the toolchain,
so every rule is testable without a network or a build.

- [Precompiled.Plan](Precompiled.Plan.md): What `Precompiled.install/2` would install (`dry_run: true` returns it).
- [Precompiled.Trust](Precompiled.Trust.md): The trust chain's top: a root document shipped with this library names the
keys allowed to sign batches; a batch names every manifest by hash. Both
travel in an envelope signed over raw bytes. Sequence numbers only go up.

## Mix Tasks

- [mix precompiled.bundle](Mix.Tasks.Precompiled.Bundle.md): Writes a bundle a device installs from with no network:
`Precompiled.install(:recon, source: "file:///media/usb/precompiled")`.
It plans on this host exactly as the device would, from the device's
facts, and copies only what that plan needs.
- [mix precompiled.clean](Mix.Tasks.Precompiled.Clean.md): Removes every dependency `precompiled` installed in the current
`_build` (this `MIX_ENV` and `MIX_TARGET`), so the next `mix compile`
compiles them from source (or installs them again, when the library is
on). Only build dirs that carry the provenance file an install writes
are removed; a dependency Mix compiled is never touched.
- [mix precompiled.deps](Mix.Tasks.Precompiled.Deps.md): Installs signed precompiled builds of the dependencies Mix is about to
compile, and rechecks the ones installed earlier. Not meant to be run by
hand: add it to the project's `deps.loadpaths` alias, which every
`mix compile`, `test`, `run` and `release` passes through before Mix
compiles the dependencies
- [mix precompiled.install](Mix.Tasks.Precompiled.Install.md): Run through `mix igniter.install precompiled`. Makes the
`precompiled` dependency `runtime: false` and puts
`"deps.compile precompiled", "precompiled.deps"` at the front of
the project's `deps.loadpaths` alias, before any steps already there.
No config is written: the source is the official API unless
`config :precompiled, source: ...` names another. Running it again
changes nothing. Not for umbrellas: add the alias to
the umbrella root by hand (see `mix help precompiled.deps`).
- [mix precompiled.report](Mix.Tasks.Precompiled.Report.md): Sends what the last build in this `_build` (this `MIX_ENV` and
`MIX_TARGET`: run it with the same ones as the build) hit, missed and
failed to the configured source, so misses can be analysed and fixed.
It shows exactly what will be sent and asks first.
- [mix precompiled.status](Mix.Tasks.Precompiled.Status.md): Lists every dependency in the current `_build` (this `MIX_ENV` and
`MIX_TARGET`) that `precompiled` installed, with the batch and
manifest it came from, and where the cache lives.

