# fx-init $ fx-init

The running fixpoint-linux system

the M4 init system — a lean PID1/supervisor with roll-forward rollback · a datalog control/query plane over /run/fx/control.sock · a DAFSA-interned service log DB

One binary, the whole running system

// fx-init is PID1 + supervisor + sole writer of runtime state

fx-init is a single cosmocc APE binary with one poll(2) event loop. It reads the CURRENT store generation, performs boot-status + roll-forward rollback, execs dhake on the generation's buildfile to materialize the rootfs (/etc, /bin symlinks, /run), then starts and supervises services with readiness, health, restart policy, and backoff.

It is the sole writer of the volatile runtime DB and the log DB. The actor model is enforced structurally: dl_open takes a process-lifetime exclusive fcntl lock, so the immutable store DB is opened only transiently for reads / rollback / activate — never held. fxctl never opens a DB directly; every query goes through the control socket.

How a boot decides ok — activation → generation → Dhakefile → rootfs, then a START-ONLY grace rule, then roll-forward rollback on the next boot.
The boot sequence →
  • PID1 + supervisor — mkdirs run-dir, signal handlers, holds the runtime + log DBs for life, execs dhake, supervises services.
  • Sole writer — the only process that ever writes the runtime datalog DB; fxctl queries via the socket, never the DB.
  • Roll-forward rollback — a stale in-progress/failed boot for the current version rolls forward to the newest known-good predecessor, monotonically.
  • No Dhall at boot — config is evaluated at activation time; fx-init reads service facts back out of the store DB. It links no dhall-c.

Four binaries

// fx-init · fx-activate · fxctl · fx_probe/fx_log
BinaryRole
fx-initLean PID1/supervisor (U-C1). Boot-status + roll-forward rollback, execs dhake to materialize rootfs, supervises services, sole writer of the runtime DB.
fx-activateBuild-time activation (U-B). Evaluates config.dhall, computes the closure, emits a per-generation Dhakefile, writes generation facts, publishes a store snapshot.
fxctlThe datalog control/query plane (U-D). Pure POSIX client — links nothing from vendor; every request is one line over /run/fx/control.sock.
fx_probe / fx_logThe init-hosted probe loop (U-C2) over /proc,/sys and the compact DAFSA-interned service log DB.

Composed, not built

// vendored submodules in vendor/

This repo is self-contained — it owns the entire running-system surface and composes the org's proven components as vendored submodules. No glue scripts; each component is a real, independently-built artifact.

ComponentRole
fxstorethe content-addressed store — store / closure / snapshot primitives.
datalog-dafsathe Datalog / DAFSA engine — runtime + log relations, hybrid search.
dafsathe compact shared-suffix store — log message interning.
dhakethe Dhall build runner — rootfs materialization at boot.
dhall-cthe config language evaluator — activation.

Reference pages

// boot · supervise · activate · fxctl · logs
  • Boot — activation → generation → Dhakefile → rootfs; boot-status; roll-forward rollback.
  • Supervise — the on= readiness graph, restart policy + backoff, START-ONLY boot-ok, reap.
  • Activate — config.dhall → closure → per-generation Dhakefile → facts → store snapshot.
  • fxctl — the datalog control/query plane over /run/fx/control.sock.
  • Logs — the probe loop and the DAFSA-interned service log DB.