| Key or variable | Meaning |
|---|---|
:source | The precompiled API URL. Default: https://compatibility.nerves-project.org/api/precompiled. https only (http on loopback). Config only. |
:except | Dependencies never installed precompiled, e.g. [:ash]. |
:content | Content origins (mirrors, CDNs) to fetch files and manifests from instead of the ones the signed batch names. https only (http on loopback). Config only. |
:root | A root.json to trust instead of the one this library ships. Config only. |
:home / PRECOMPILED_HOME | Cache and trust state dir. The config key beats the variable. Default: the user cache dir (:filename.basedir(:user_cache, "precompiled")). PRECOMPILED_HOME=~/.nerves/precompiled keeps using the pre-rename cache. |
:deadline_seconds | All network for one run (default 300); what is still waiting then compiles. Root and batch get 15 s together, connects 5 s. |
:root_check_seconds | How often the served root is checked for a rotation (default 3600; a batch that fails to verify checks it at once). |
:host_native | true opts in to host-native builds (default false): on a Linux glibc host, x86_64 or aarch64, that is no Nerves target, a NIF package no other build serves may install a build made for this machine's triple, its beams and .so files together. It is ABI-compatible with this machine, not the bytes your own compile would produce. It installs only when its OTP and NIF versions are no newer than this VM's, every library it needs is here with every symbol version it needs, and a library the package downloads from an upstream release is the one its own checksum file pins. Mix.install/2: config: [precompiled: [host_native: true]]. |
:cache_max_mb | Cache size bound (default 4096), least recently used evicted, checked once a day. Last use is recorded at most once a day per entry, so the eviction order is approximate within a day. Trust state is never evicted. |
:fetch_retry_waits_ms | The waits, in ms, before each retry of a request that failed transiently: a 500, 502, 503 or 504, or a refused, closed or timed-out connection (default [500, 2000], each up to 25 % later; [] never retries). A 503's Retry-After of at most 5 s is waited out; the waits of one request together stay under 5 s. Any other answer, a body over its size or one that fails its checksum is never asked again. |
PRECOMPILED=0 | Off: installs nothing and removes earlier installs. |
PRECOMPILED_OFFLINE=1 | No network: the cached batch (while fresh) and cached files only. |
PRECOMPILED_CACERTS_PATH (or HEX_CACERTS_PATH) | A PEM CA bundle that replaces the OS store (TLS-intercepting proxies). Verification stays on; only the bundle's CAs are trusted. |
HTTPS_PROXY/https_proxy, HTTP_PROXY/http_proxy, NO_PROXY/no_proxy | Proxies, as Hex reads them. Credentials in the proxy URL are sent only to the proxy. NO_PROXY takes host names, domains (.corp.example), IP addresses and *; CIDR ranges are ignored. |
PRECOMPILED_DEBUG=1 | Also print each dependency that was not a candidate, and why. |
PRECOMPILED_COMPILE_CACHE=0 | Compile this library itself on every fresh _build, instead of reusing its own compiled modules from deps/precompiled/.compile_cache (see below). |
The keys go in config :precompiled, ...; Precompiled.Host.install/2
also takes :except and :home as options. :source, :root and
:content are project config only: no option or environment variable
sets them, because a source or mirror learns which dependencies you use
and a root decides whose builds run (see Trust). The old names (config :nerves_precompiled,
config :nerves, :precompiled, NERVES_PRECOMPILED*) are still read for
one release, when the new ones are unset.
Turning it off
PRECOMPILED=0(falseandnowork too) turns it off and removes the builds it installed, so Mix compiles them in that same run. Only build dirs this library wrote are removed, never one Mix compiled, and only in the_buildof the run's own env and target: a run onhostremoves host installs, never a device target's.mix precompiled.cleanremoves this_build's installs.--cachealso empties the download cache (files, manifests, systems tables and source scans), from the same cache dir a run uses.:exceptkeeps listed dependencies compiled from source; an earlier install of one is removed.
This library's own compile
The deps.compile precompiled step compiles this library before it can
install anything. As a dependency fetched from Hex it keeps its compiled modules in
deps/precompiled/.compile_cache, so a fresh _build (another MIX_ENV
or MIX_TARGET, rm -rf _build, mix clean --deps) restores them
instead of compiling again. The entry is keyed on the Elixir and OTP
versions, the compiler options, every source file of the library and the
project's config :precompiled;
each restored file is checked against the sha256 recorded when it was
saved, and Mix still checks the restored build as it checks its own.
It lives in the deps dir, so it trusts nothing that the sources Mix
compiles do not already. Only a dependency Hex fetched is written to: a
path or git checkout of this library, an unpacked Hex package used as a
path dependency included, is never written to. mix deps.clean precompiled removes it with the sources.
One entry is kept per deps dir. CI that shares one deps/ across several
Elixir or OTP versions replaces the entry on every version change, so it
compiles the library each time as before: it loses the speed-up, never
correctness.
Seeing what happened
Every candidate prints one line, then a summary:
precompiled: ash 3.36.0 HIT 4.1 MB; build 3f2a9c01b7de: Elixir 1.20.0/OTP 28
precompiled: nerves_pack 0.7.1 MISS built with nerves_ssh 1.3.3, project has 1.3.2
precompiled: 40 hit, 5 miss, 0 fail of 45 deps, 61.2 MB, 8.3 sA warm run whose installs the batch still vouches for prints nothing.
mix precompiled.statuslists what is installed in this_build, with the batch and manifest each came from._build/<env>/lib/.precompiled/report.json("format": 1) holds the last run that printed lines.- Each installed dependency carries
.mix/precompiled.json.