The yen engine is domain independent: it knows no host, no user and no NixOS. The examples in these docs write
every rule by hand, so you can see each step. Many rules come back in every fleet.
A battery is such a rule, ready to use, as a plain Nix value. This is how a fleet uses two of them:
You write yen.kinds.…, the sinks and the aspects with your own names. The battery is the value of one key.
Above, unfree is the value of the nixos key of a sink, and hostname is the value of the nixos key of an aspect.
A battery adds no word to your fleet. It reads only scope and sinks, and it takes the sinks it reads
as refs, so it works in any fleet.
yen.lib.batteries has two kinds of battery:
Generic batteries, at the top, know no domain: mesh, claim, ordered. See Generic batteries.
A pack is the batteries of one domain, under its name: yen.lib.batteries.nixos. See NixOS batteries.
When a battery does not fit, write your own with the same shape. It is a few lines of Nix in your fleet:
Write your own. The packs:
Generic batteriesmesh, claim, ordered, eval-modules, configurations, imports: values for keys you write. And how to write your own.
Platform batteriesNixOS, nix-darwin, home-manager, nix-on-droid and microvm.nix: each kind builds its output with a battery; homes go into machines.
NixOS batteriesyen.lib.batteries.nixos: system, accounts, shells, autologin, unfree, firewall, hosts, builders, persist, facter. NixOS options are the domain; yen keys are yours.
Kits batteriesKits and assemblies: members by `at` predicates, layered settings, exports, contracts, vars generators and their plan.
Repo batteriesfiles, github, devshell, flake-file: README, CI workflow, ci.json, dev shell and flake.nix, written from fleet data.
Access kitssshd, users and emergency-access: ready-made kits for who may log in, and the known-hosts battery that lets machines trust each other.
Network kitsReady-made kits from yen.lib.kits: wireguard, zerotier and dns, with battery addresses.
Kits of the libraryReady-made kits for backups, wifi, remote builders, a binary cache, monitoring and postgres: the fleet writes only assemblies.
Diagram and docs batteriesmermaid views of scopes, kinds, gates and routes; tables, links that follow edits, doc lines checked against live names.
Bundles of the libraryA bundle is a kit whose assemblies make more assemblies: base for a new machine, homelab for a server and its nodes.
Caches and secrets batteriescachix caches trusted by hosts and the flake, pushed from CI; secretspec.toml and .sops.yaml from what each feature declares.
Deploy and infrastructure batteriescolmena and deploy-rs, terranix, Kubernetes manifests, machines writing config into each other, modules exported for other flakes.
Editor and AI batteriesVS Code and Zed from language aspects; one pool of agent extensions (skills, MCP servers) that each agent filters.
Install and deploy kitsDisk layouts as data, the disko and facter kits, install apps with nixos-anywhere, rebuild apps with nixos-rebuild.
Lean verification batterylean.verify: a flake check that builds only when the Lean-proven checker verifies the fleet's verdict.
WSL and system-managerOne fleet for NixOS, NixOS on WSL, and other Linux distributions with system-manager: shared aspects, one output per kind.