# precompiled v0.2.0 - 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)

## 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: `config :precompiled, source: url` plus
`except: [dep, ...]` and `root: path`; `Precompiled.Host.install/2` passes
the same keys as options.
- [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`, adds
`config :precompiled, source: ...` to `config/config.exs`
(`--source URL`, default the public Nerves compatibility portal) and puts
`"deps.compile precompiled", "precompiled.deps"` at the front of
the project's `deps.loadpaths` alias, before any steps already there.
Running it again changes nothing. Not for umbrellas: add the alias to
the umbrella root by hand (see `mix help precompiled.deps`).
- [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.

