ZoiOS Management
Declarative system management features exclusive to ZoiOS distributions.
ZoiOS (and its reference implementation, Parlex Linux) features a declarative system management engine powered by Zoi. These features allow you to manage the entire operating system state using a single Lua configuration file.
The commands on this page are only available on ZoiOS-based systems. Generic Linux, macOS, and Windows installations of Zoi do not include these features.
The zoi system Command
The zoi system suite is used to manage system-level generations and configuration.
zoi.system.apply [file]
Reads a system.lua file and applies its state to the machine. This involves:
- Resolving all required packages.
- Creating a new System Generation record.
- Directly installing/updating packages in the system root within an atomic transaction.
- Declarative State Enforcement: Automatically identifies and removes any packages currently installed in the system scope that are not explicitly listed in the configuration file.
# Apply the default system configuration
sudo zoi system apply
# Apply a specific configuration file
sudo zoi system apply ./my-server.luazoi system distro build --target <path> --config <file>
The primary command for bootstrapping new ZoiOS systems onto manually partitioned and formatted disks.
Safety Features:
- Pre-flight Validation: Automatically verifies that all base packages exist in your registry before touching the disk.
- Build Plan Summary: Shows a detailed table of configured filesystems and packages before proceeding.
- Dry-Run Mode: Use
--dry-runto see exactly what commands will be executed without modifying your hardware.
# Preview the build plan
sudo zoi system distro build --target /mnt --config ./system.lua --dry-run
# Orchestrate the full build
sudo zoi system distro build --target /mnt --config ./system.luazoi system distro chroot <target>
Enter a ZoiOS sysroot (chroot) with automatic device mounting and sandbox protection. This is the recommended way to run commands like dracut or grub-install during the final stages of bootstrapping a ZoiOS installation, as it ensures all operations are safely contained within the target environment.
Options:
--run <command>: Run a specific command inside the chroot and exit, rather than dropping into an interactive shell.
# Enter an interactive shell inside the ZoiOS root
sudo zoi system distro chroot /mnt/zoios
# Run a specific command inside the ZoiOS root
sudo zoi system distro chroot /mnt/zoios --run "grub-mkconfig -o /boot/grub/grub.cfg"zoi system list
Lists all available system generations on the machine, including their creation date, the packages they contain, and their linked Zoi transaction IDs.
zoi system listzoi system status
Shows the current system status, including the active generation ID and transaction state.
zoi system statuszoi system rollback <id>
Reverts the operating system to a previous generation by sequentially rolling back the Zoi package transactions that occurred after the target generation.
sudo zoi system rollback 41zoi system secret
Manage sensitive information like passwords and API keys.
zoi system secret hash <password>: Generates a one-way Argon2 hash of a password. Use this in yoursystem.luafor user passwords.zoi system secret encrypt <value>: Encrypts a string so only Zoi on this specific machine can decrypt it. It returns aZOISEC:v1:...string.
zoi system secret decrypt <ZOISEC>
Decrypts a ZOISEC string back to plaintext (useful if you forgot the value)
Declarative Configuration
ZoiOS uses two primary Lua files to manage its state:
- system.lua Reference: Manage system-wide packages, users, bootloaders, and filesystems.
- home.lua Reference: Manage your personal user environment, dotfiles, and user-scoped packages.
Bootstrapping a System
A functional ZoiOS system is defined by a collection package, typically @core/base. This package provides a foundational set of utilities (POSIX tools, C library, Shell) and allows you to choose your primary system components via interactive or declarative options.
The @core/base Profile
When installing or building a ZoiOS system, you can pre-select your core components in system.lua to avoid interactive prompts:
-- /etc/zoi/system.lua
packages({
["@core/base"] = {
options = {
"zoi:@core/systemd", -- Choose your Init system
"zoi:@core/linux-hardened", -- Choose your Kernel
"zoi:@core/doas" -- Choose your privilege escalator
}
}
})Multi-Init and Escalation Support
ZoiOS is designed to be flexible. It supports multiple init systems and privilege escalation tools out of the box:
- Init Detection: Use
SYSTEM.INITin your.pkg.luascripts to detect if the target system is runningsystemdoropenrc. - Privilege Escalation: Zoi automatically detects and uses either
sudoordoasfor Just-in-Time escalation. In yourbasepackage, these are interchangeable virtual providers.
Architectural Foundation
ZoiOS uses a Transaction-based architecture:
- The Store: All packages reside in
/var/lib/zoi/pkgs/store/, isolated by version and input hashes. - Shared Pool: Zoi packages use a "Shared Pool + Mapping" architecture. Files are stored in a central
pool/directory within the archive and mapped to their final destinations (/usr,/etc, etc.) at install time based on the scope. - Generations: A generation is a lightweight record (e.g.
/var/lib/zoi/generations/42/) of the system state, linked to a specific Zoi package transaction. - Traditional Management: Unlike NixOS, ZoiOS installs files directly into the system root (
usrroot). Rollbacks are performed by sequentially reverting package transactions, providing a traditional FHS experience with declarative safety.
Packaging Conventions
For developers building ZoiOS-native packages:
- Scope Awareness: Use
ZOI.scopein your.pkg.luato adjust behavior. WhenZOI.scope == "system", files should generally be staged to${usrroot}/usr/...or other absolute paths. - Pooled ZPA: Zoi automatically builds "Pooled" archives that capture the package state for
user,system, andprojectscopes simultaneously, ensuring zero duplication while supporting perfect scope-specific behavior. - Transactional Safety: All changes to
/usr,/etc, and/varare recorded in Zoi's transaction log, enabling atomic rollbacks of the entire system state.
2026 © All Rights Reserved.
- All the content is available under CC BY-SA 4.0, expect where otherwise stated.
- Source code is available on GitLab, licensed under Apache 2.0.
Last updated on
