API Reference precompiled v#0.2.0

Copy Markdown View Source

Modules

Installs signed precompiled libraries into a running Nerves device, with no Mix, no Hex and no compiler.

The client's configuration: config :precompiled, source: url plus except: [dep, ...] and root: path; Precompiled.Host.install/2 passes the same keys as options.

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.

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.

Install signed, verified precompiled dependency builds instead of compiling them.

One app Precompiled.install/2 installed, or one Precompiled.list/1 found in the store.

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.

What Precompiled.install/2 would install (dry_run: true returns it).

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

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.

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.

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

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).

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.