v0.7.0 - 2026-11-15
Precompiled.Host.install/2now predicts a dependency's compile-time read of another app's config from the orderMix.install/2'sdeps.compileuses in its install project, as a Mix project does. Before, every such build missed underMix.install/2withcompile-time config APP KEY would differ in this project, for examplephoenix_live_dashboardwithoutphoenix_view.Precompiled.Host.install/2now checks a build's compile-time config againstMix.install/2's:configand:config_path, applied before the check asMix.install/2applies them (the file's keys replace:config's). Before, a build that recorded a key unset was installed even when:configset it. A:config_paththat cannot be read makes every dependency that reads compile-time config compile from source.A fresh
_buildno longer compiles this library again. As a dependency fetched from Hex (never a path or git checkout) it keeps its own compiled modules indeps/precompiled/.compile_cache, keyed on the toolchain, the compiler options, every source file andconfig :precompiled, and restores them, each file checked by sha256, into a_buildthat has none: anotherMIX_ENVorMIX_TARGET,rm -rf _build. About 0.4 s less per fresh_buildon a laptop, more on a CI runner with few cores.PRECOMPILED_COMPILE_CACHE=0turns it off.Installing a build makes fewer file system calls: its dirs are made once, a file whose mode is already the one a new file gets is not set again, and a cache entry used in the last day is not marked used again (the cache gc orders by day). Every file is still hashed before it is placed.
A
MISSline now names the build that came closest after its reason:; closest build HASH: VARIANT, Elixir X/OTP Y, SYSTEM RELEASE, closure +a -b, with the first 12 characters of the build's files hash, its variant (a world build's own, elsewithorwithoutthe package's optional dependencies), its toolchain, its system and release, and how its closure differs from the one Mix compiles the package with here. AHITline names the build it installed the same way, after its size (; build HASH: ...). Only manifest values and dependency names are printed; nothing from the environment is. Reason codes and arguments are unchanged, somix precompiled.reportsends what it sent before.Precompiled.Host.install/2now reads the dependency treeMix.install/2compiles, from the dependencies Mix loads in its install project, and matches the way a Mix project on your build machine does: a build must have been compiled with exactly the package's dependencies in that tree, at any depth, optional ones included, and the builds a manifest lists underbuilds_closureare considered too. An optional dependency the install has only for another env (only: :testin a script run in dev) no longer counts as present because the lock has it. The tree is read after thelockfile:option's lock is merged into the install project, asMix.install/2merges it, so a lock that pins a dependency to another version is checked against too, where before Mix could compile a placed build's package differently from the build. When Mix cannot load the dependencies, every dependency misses (build method unknown), as before; when it loads them but their tree is not in the shape the client reads, the lock decides as before andbuilds_closureis not read.On your build machine, a build that records rebar3
platform_defineverdicts (compile_inputsitems of kindplatform_define, each a regex and whether it matched the builder's arch string) matches only when every regex decides the same against this machine's arch string, computed as rebar3 computes it (OTP version, system architecture, word size). Otherwise the line readsrebar3 platform_define REGEX decides differently on this machine(new reason codeplatform_define_differs), as it does for a regex the client cannot evaluate. On a device such a build misses with the same code: the device cannot know the machine its firmware was compiled on. Releases before this one miss on the new kind as a malformed entry.On your build machine, a project whose dependency tree the client has read also considers the builds a manifest lists under
builds_closurefor a version: builds made with a common app's optional dependencies added at every depth of the package's tree. Such a build matches only under the whole-tree comparison below, so it is never considered where the client has not read the tree, or on a device. A release readsbuilds_closureonly if it makes that comparison; earlier releases ignore the list. Abuilds_closurethat is not a list is ignored and leaves the version's other builds as they were. A manifest without it is read as before.On your build machine, a dependency Mix compiles with rebar3 no longer matches while your global rebar3 config (
~/.config/rebar3/rebar.config, or the one underREBAR_GLOBAL_CONFIG_DIR) sets a key that changes what rebar3 compiles, such aserl_opts,overrides, hooks or plugins: rebar3 merges that file into every dependency compile, so the beams built here would differ from the published build. The line readsglobal rebar3 config PATH sets KEY(new reason coderebar3_global_config) and names the key, never its value. A file that does not parse, or one with arebar.config.scriptbeside it, misses the same way, as does one whose directory cannot be searched. Mix dependencies and devices are not affected.On your build machine, nothing matches while
ERL_COMPILER_OPTIONSis set, whileERL_LIBSis set, whileERL_FLAGS,ERL_AFLAGS,ERL_ZFLAGSorELIXIR_ERL_OPTIONScarry an argument that can set it, run code or change the code loaded (-env,-eval,-pa, ...), or while a.erlangfile sits in your home or Erlang's user config directory. Each changes every compile, Elixir modules included, and no build records it. The line names the variable or file, never its value (new reason codeerl_compiler_options).On your build machine, a build matches only when it was compiled with exactly the dependencies Mix compiles the package with in your project, at any depth, for the current env: not everything
mix.lockhas. A project that pulls an optional dependency inonly: :test(asphx_newdoes lazy_html for phoenix_live_view) no longer misses the build made without it in dev and prod, and no longer accepts there a build made with it, directly or further down the tree, which Mix would compile differently: that misses withbuilt with NAME, which Mix leaves out of it in this env. In test the build with it matches, as before. A dependency Mix loads but the lock has no Hex entry for (a path dependency withoverride: true) now misses every build that lacks it (built without NAME, which is not a Hex dependency here). Versions and checksums are still checked against the lock.Mix.install/2projects and devices behave as before.
v0.6.0 - 2026-11-13
- Builds whose compile read an environment variable or the whole
environment are now published, with what the compile read
(
compile_inputs). This release reads them; earlier releases never see them and behave as before. - On your build machine, a build that read a variable matches only when
your environment gives the same value (unset or set alike): otherwise
built with a different NAME. Your value is never printed or reported. A variable the build set itself, from inputs it recorded, is not compared. A build that read the whole environment, or whose config reads were not all recorded, does not match. - On a device, a build that read a variable matches when the variable was
unset at build time; one built with it set misses with
built with NAME set at compile time; a device cannot check its firmware's build environment. - A build that records its compile inputs is no longer refused by the
module-level
System.get_envscan (rule 8); builds without them still are. - A build whose dependency read an unset config key of an app outside
its own dependency tree (
Application.get_envin a module body) records what it saw and the app's.appdefault. On your build machine the client predicts whatmix deps.compilewould give it in your project, from your config and your deps' compile order: a different value misses withcompile-time config APP KEY would differ in this project. In a partitioned compile (MIX_OS_DEPS_COMPILE_PARTITION_COUNTabove 1), such an item misses unless your config sets the key or the app is not among your dependencies (nor part of OTP or Elixir); then it is compared as above. On a device such a build matches only when the app's.appgives the key no default and the device's config gives the value the build saw. - New miss report codes:
env_differs,env_set_at_build,env_all,config_unrecorded,config_order_differs.
v0.5.1 - 2026-11-12
- On a device, an optional dependency (such as
:rustlerforrustler_precompiled) no longer blocks an install when this target has no build of it: the package installs without it. - On a device, optional dependencies are no longer installed along with a
package:
install(:axon)skipskinoand the like unless the device has them or the call asks for them (install([:axon, :kino])), prints one line per skipped dependency, and prefers a build locked without them. - On a device, an online install no longer waits for NTP: it goes ahead
with the clock as it is and lets the batch's own time checks decide.
Only when one of them fails before NTP has answered does it say to wait
for NTP (still
{:error, {:clock_unsynchronized, now}}). - On a device, a store too small for an install prints one readable line
with the sizes, the store directory and the largest build, instead of
the raw
{:too_big, needed, free}(the returned error is unchanged).
v0.5.0 - 2026-11-12
- Target builds now match across releases of the same Nerves system: beam-only builds always, NIF builds when the toolchain series, OTP version and needed libraries line up (checked on the host against the portal's systems table and on the device against its own libraries).
- On a device, every native build, for the exact release too, is checked
against the device's own
/liband/usr/libbefore it is installed. - Beam-only builds with no priv files match across releases too.
v0.4.0 - 2026-11-11
- New
mix precompiled.reportandPrecompiled.Host.report/1: send the last build's HIT/MISS/FAIL report to the configured source, after showing exactly what will be sent and asking first (--yesfor CI,--dumpto only look). Lines go as stable reason codes with package names and versions, and only the project's public Hex lock entries go with them; a Nerves system that is not a public Hex package, and any reason that would name it or the target, is sent ascustominstead. Sending the same report twice answers "already received" and no id, since the source hands an id out only once; the id from a first send is the only way to retract it (DELETE <source>/reports/<id>). Nothing is ever sent during a build, and the task always exits 0. report.jsonlines gainreason_codeandreason_args, and the report gainsbuilt_atand the build'scontext(Elixir, OTP, target, Nerves system). Existing fields are unchanged. A build with no candidate dependencies does not write a newreport.json; the previous one, and whatever it reports, stays in place.mix precompiled.report(andPrecompiled.Host.report/1) need areport.jsonwritten by this release: one from an earlier release lacks the fields above, and the command says so and sends nothing rather than guessing.
v0.3.2 - 2026-11-10
Security
- Recorded compile_env values are decoded with size, compression and term
kind limits. A value over 64 KiB, a compressed one, or one holding a
fun, pid, port or reference anywhere is never decoded into a usable
term: it differs from the project's value, so that build misses with
compile_env differs: ...and the dependency compiles from source. Before, a small compressed value was inflated in full while it was read. A value that is not valid base64 is a miss too, never a raise. The local source-scan cache is read with the same limits; an entry outside them is rescanned.
v0.3.1 - 2026-11-10
- New matching rule 9, build method. A dependency whose
depsentry sets:manager,:compileor:system_envis built differently from any precompiled build, so it always compiles from source, with a line such asMISS project sets :manager for this dependency. This includes options a package's ownmix.exssets on its dependencies, underPrecompiled.Host.install/2too. An installed build is removed on the next run once such an option appears. - A global
Mix.install(deps, system_env: ...)is not treated as an override: it is the same as the shell environment, which no rule records. Builds are made in a clean environment, and a dependency whose compile-time output depends on environment variables is a known limitation (Known limitations, Matching). - Under
Precompiled.Host.install/2, when Mix cannot load the dependencies, every one misses withbuild method unknown (deps did not load: ...), after one warning naming the cause. - A manifest build may record
manager(a string such as"mix","rebar3"or"make"). When it differs from the manager Mix resolves for the dependency, the build misses:built with rebar3, project builds with make. A build withoutmanagermatches as before. The device API (Precompiled.install/2) does not compare it.
v0.3.0 - 2026-11-10
Breaking changes. A source or mirror learns which dependencies a project has, and a root decides whose builds run, so all three are now set only in the project's config, never by an option or environment variable a pasted snippet could carry (see the Trust guide).
- The source defaults to the official API,
https://compatibility.nerves-project.org/api/precompiled, checked against the shipped root. No source configured no longer means off; to turn it off, usePRECOMPILED=0,config :precompiled, :device, enabled: falseon a device, or:exceptper dependency. Precompiled.Host.install/2no longer takes:source,:rootor:content; passing any of them raisesArgumentError.config :precompiled, source: ..., root: ..., content: [...]still sets them.PRECOMPILED_SOURCE(andNERVES_PRECOMPILED_SOURCE) is no longer read.- On a device, a per-call
:sourcemust be afile://bundle; a network source per call returns{:error, {:source_not_allowed, source}}. A network source comes fromconfig :precompiled, :device, source: ...or the default. A per-call:contentreturns{:error, {:content_not_allowed, origins}};content:in the:deviceconfig still works. - The Igniter installer no longer writes
config :precompiled, source:and has no--sourceoption.
Also:
Precompiled.Host.install/2starts Mix itself, asMix.install/2does, so it works in a fresh Livebook runtime.- The "Mix.install and Livebook" setup is one cell that installs the archive when it is missing.
- The Nerves, What matches, Trust and Troubleshooting guides are rewritten for reading, mostly as tables, and Known limitations is its own guide.
- The docs are titled "Precompiled", and the README has a Nerves compatibility badge.
v0.2.1 - 2026-11-10
- Docs only. The README's guide links open the HexDocs pages again (on
hex.pm they opened the raw Markdown),
Precompiled.Host.run/1documents its ownreport()type, and the docs build without warnings. mix hex.publishruns in the docs env, where ex_doc lives.
v0.2.0 - 2026-11-10
Renamed to
precompiledbefore the first Hex release: the app and package:precompiled, modulesPrecompiled.*(the host API,run/1and theMix.install/2wrapperinstall/2, is nowPrecompiled.Host;Precompileditself is the device API), configconfig :precompiled, environment variablesPRECOMPILED_*, the default cache dir:filename.basedir(:user_cache, "precompiled"), the provenance file.mix/precompiled.jsonand the archiveprecompiled-<vsn>.ez. The Igniter installer ismix igniter.install precompiled(mix precompiled.install), and thedeps.loadpathsstep it adds is nowmix precompiled.deps. A clean break: none of the interimelixir_precompilednames is read, and a cache under the old dir is simply not used. The repository keeps its name,elixir_precompiled.Precompiled.install/1,2installs signed precompiled builds into a running Nerves device from an IEx shell, with no Mix, Hex or compiler on the device: it selects the build for the device's system, OTP, Elixir, CPU and present apps (by name and exact version), verifies every byte, loads and starts it with its absent runtime dependencies, and rolls the whole call back on any failure. Nothing present is ever replaced.Precompiled.list/1,Precompiled.uninstall/2anddry_run: true(withreport:for a bundle) come with it. See the "On a device" guide.On by default, with the official signed source (
https://compatibility.nerves-project.org/api/precompiled) as the default source; it only acts when called.config :precompiled, :devicesetsenabled: false(no installs),allow: [...](an allowlist), anothersource,dir,max_bytesandcacerts_path;enabledandallowcannot be overridden by a call.Installs are kept as a cache on
/dataacross reboots, never loaded at boot; installing again loads from the cache after re-verifying every file. The cache is bounded bymax_byteswith least recently used eviction, andPrecompiled.clean/0empties it.file://sources: a bundle directory with the API's layout, read from local storage only, with no network and no network apps.Offline bundles: a bundle's
offline.json, signed by the root'sofflinerole, has no expiry and needs no clock; a device honours it only from afile://source, under a root with anofflinerole, and never below the highest offline sequence it has seen. A device adopts a newer root from a bundle when it chains. The shipped root has noofflinerole yet, so a bundle is valid for its batch's 24 hours.mix precompiled.bundle PKG[@REQ]... --out DIRwrites a bundle on a host with network, planned from the device's facts (flags, or a dry run's--device-report), with every byte checked before it is written.mix igniter.install precompiled --devicekeeps the dependency at runtime so it ships in the firmware, and addscastoreunless the project already depends on it.:inets,:ssland:public_keyare optional applications;:cryptostays required. A firmware without them installs from bundles only (an online call returns{:error, {:missing_app, app}}).cacerts_path:(an option ofPrecompiled.install/2and a:deviceconfig key) names a PEM CA bundle for a device install. Without one (and withoutPRECOMPILED_CACERTS_PATH/HEX_CACERTS_PATH), an empty or missing OS certificate store now falls back to thecastorepackage's bundle when that is loaded. With no certificates at all the error now readsno CA certificates(before:no CA certificate store on this system), and an empty store is that error too, never a TLS attempt with no CAs.The host's check that an installed build is still intact is stricter about
priv: aprivthat is a copy rather than Mix's link to the dependency's sources (as on Windows, where links may be refused) no longer counts as intact, so such a build is installed once more.enabled: falsedisablesinstall/2only:list/1,uninstall/2andclean/1keep working, so what is installed can still be removed.
v0.1.0 - unreleased
- Any Mix project can use it:
mix precompiled.deps, reached through adeps.loadpathsalias (mix igniter.install precompiledadds it), installs builds before Mix compiles dependencies in plain projects, umbrellas and Phoenix apps, and for Nerves with released nerves too, where onlypure_elixirbuilds match: system (target) builds need the Nerves fork'sNerves.build_plan/0to name the system.Precompiled.Host.run/1for the nerves hook is unchanged. The Igniter installer sets the dependencyruntime: false,:sourceinconfig/config.exsand the alias, prepended to an existing one; Igniter is an optional dependency, declared only on Elixir 1.18+. - Never fails a build: any internal error is one warning and a source
compile; no
HOMEor an unwritable cache moves the cache under_build. - Warm runs make one conditional batch request (
If-None-Match) and download nothing once the source answersIf-None-Matchwith304(until then the batch itself is downloaded again; manifests and files still come from the cache); the root is checked at most once an hour; manifests are cached by SHA-256; files of a dependency download in parallel.PRECOMPILED_OFFLINE=1works from the cache; a run has a network deadline (:deadline_seconds, 300; root and batch 15 s). When the source cannot be reached, a cached batch that still passes every check is used; a refused response never falls back. A source that failed to connect is then not asked again in that run, so uncached manifests and files miss at once; a content origin that fails to connect is skipped for the run (the source still serves). - Content origins: the signed batch (or
:content) may name CDNs for files and manifests, with fallback to the source; every byte is still checked. - An installed build is kept while the batch still offers its exact files, so a new portal run of the same inputs no longer recompiles the project.
- Install refuses colliding paths (duplicate, case or Unicode variants,
path collision: ...), paths that are not plain relative paths inside the dependency's own build dir (unsafe path or mode (...)),ebin/entries other than beams,<dep>.appand<dep>.appup, such as another app's.app(foreign path: ...), and beams the.appdoes not list; linking happens before the install is renamed into place. A cache entry that is a symlink is never followed: that dependency compiles, and the line names the path to remove. - Dependencies that read
Mix.target()or environment variables at compile time are matched on them (README, rule 8). nerves' own dependencies are recognised from Mix's dependency data, so a git or pathnerveskeeps them out.PRECOMPILED=0, or no source configured, now removes installed builds (Mix compiles them in that run). Only the_buildof the run's own env and target is touched: under Nerves a run onhostremoves the host installs, never a device target's.mix precompiled.statusandmix precompiled.clean [--cache]; the cache is bounded (:cache_max_mb, 4096).- A batch the source did not deliver is reported as
batch unavailable: <why>(before: the bare reason); a delivered batch that fails a check is still reported by the check alone (batch stale,batch signature invalid, ...). - Lower-case proxy variables,
NO_PROXY, and a CA bundle (PRECOMPILED_CACERTS_PATHorHEX_CACERTS_PATH). The bundle replaces the OS store, as Hex's does: verification stays on and only its CAs are trusted. PRECOMPILED_SOURCEopts in without a config change; it wins over app config, an explicitsource:option wins over it. An empty value counts as unset.Precompiled.Host.install/2on Elixir 1.17 and 1.18 installs into the dirMix.install/2uses there (elixir-<vsn>-erts-<vsn>); before, its installs landed beside it and Mix compiled everything.- CI runs Elixir 1.17 to 1.20.
- A batch issued more than 24 hours ago, more than 5 minutes in the future, valid for more than 30 days, or read against a local clock earlier than this library's build time, is refused; the run falls back to compiling, same as an expired or rolled-back batch.
- Every run,
Precompiled.Host.install/2included, rechecks dependencies an earlier run installed (in a Mix project's_buildor theMix.install/2project) against the current batch: one the batch no longer names, or one newly listed in:except, is removed and compiled from source; one whose manifest changed is matched again. When no batch is available, installed builds are left as they are and one warning line says how many were kept, not rechecked (report.jsonstill lists each asfail,(installed build kept)). Builds installed by an earlier version carry no provenance file and are rechecked only aftermix deps.clean --buildor a clean_build. - Root rotation follows TUF: an intermediate root that expired after a newer one was adopted no longer ends the chain; only the root in use must be unexpired. Before, v1 -> v2 -> v3 fell back to v1 once v2 expired, which with the version floor failed every run.
- The adopted root version is kept and never goes back (the error names
the
root_versionfile to delete to accept an older root); a trust-state file that exists but will not parse is warned about and treated as 0. - On a device, the Nerves system is read from
/usr/lib/os-release; the loaded-application lookup never matched because systems areruntime: false, so devices only got pure-Elixir hits. - Extracted from nerves PR #1220:
Precompiled.Host.run/1is the build-time stepnervescalls;Config,Match,TrustandFetchmoved unchanged apart from their HTTP client and output. - New:
Precompiled.Host.install/2,Mix.install/2with the precompiled step in front of it, for use on a device. - Config moved to
config :precompiled, source: ...; theconfig :nerves, :precompiledform still works. - On a device, a dependency already compiled in the
Mix.install/2project is no candidate again: a second boot with a cached install re-places nothing and works offline. Builds this library installed there are rechecked against the batch, so such a boot fetches the root and batch. - Every HTTP request has an overall deadline (300 s by default) on top of the inactivity timer, so a server that keeps dripping data cannot hold a build or a boot open.
precompilednever installs a portal build of itself.- Renamed to
precompiled; old config keys andNERVES_PRECOMPILED*variables still work for one release. - Reads manifest format 2: a version lists its builds, each with a target
(
pure_elixiror a Nerves system) and the toolchain it was made with. Format 1 manifests still work. - Matching rules: the running Elixir must have the build's minor and at
least its patch (pre-releases compare as older), the OTP major must be
equal, and the dependency's compile env (
dep_env,produnless the project overrides it withenv:) must equal the build's. Among passing builds the closest Elixir patch wins, thenpure_elixir, then the newest run. report.jsoncarries"format": 1.- Ships as a Mix archive (
mix archive.install github TomHoenderdos/elixir_precompiled) so Livebook and scripts can callPrecompiled.Host.install/2in place ofMix.install/2; CI builds it. - The file cache moved from
~/.nerves/precompiledto the user cache dir (:filename.basedir(:user_cache, "precompiled"),~/Library/Caches/precompiledon macOS,~/.cache/precompiledon Linux). The old directory is not migrated, so the first run after upgrading downloads everything again; setPRECOMPILED_HOME=~/.nerves/precompiledto keep using the old one.