xgen is the Rust replacement for the X Linux generations engine that currently
lives in scripts/install/helpers/xgen.sh, xgen-home.sh and
xgen-system.sh. It manages bootable system snapshots, home dotfile
generations, portable bundles and the declarative system.toml layer.
The project is developed locally. The implementation session does not perform git operations; committing and publishing is a separate, explicit step.
The implemented surface includes:
- system generations: new, list, status (text and JSON), boot, rollback, diff, verify, pin/unpin, prune, restore, export/import, quota;
- home generations: new, list, status, diff, restore, prune;
- declarative system: plan and apply with dry-run;
- automatic generation entry point for hooks (
xgen autoandxgen home auto); - dir and btrfs backends, systemd-boot and GRUB entries, multi-kernel capture;
- signed and encrypted bundles with metadata or snapshot data.
./scripts/test.sh # full local test suite
./scripts/check.sh # fmt + clippy + tests, all caches local
cargo build --release
sudo ./scripts/test-btrfs.sh # root-only btrfs loop testThe development workflow used in this repository keeps all temporary state inside the workspace:
export CARGO_HOME="$PWD/.cargo"
export TMPDIR="$PWD/.tmp"
cargo test --workspaceThe btrfs integration test is gated: it runs only as root with btrfs-progs
and losetup available, and otherwise reports a skip. The GPG tests run only
when gpg is installed.
mkdir -p /tmp/xgen-demo/{root,state,snapshots,root/boot}
printf 'demo-host\n' > /tmp/xgen-demo/root/etc/hostname
xgen --backend dir \
--root /tmp/xgen-demo/root \
--state /tmp/xgen-demo/state \
--snapshots /tmp/xgen-demo/snapshots \
--boot off \
new --reason manual --label demo
xgen --backend dir --state /tmp/xgen-demo/state \
--snapshots /tmp/xgen-demo/snapshots --boot off listxgen/
Cargo.toml workspace
rust-toolchain.toml pinned toolchain
crates/xgen-core/ typed engine library
src/backend/ btrfs and dir backend adapters
src/bundle/ tar, checksums and GPG
crates/xgen/ CLI binary
src/cli.rs clap definitions and flag/env surface
src/run.rs command dispatch
tests/ integration tests
docs/ architecture, CLI, state, bundles and testing
- State layout, manifest schema 2 and home manifest schema 1 are unchanged.
- Boot entry names and the shared kernel store under
x/kernelsare unchanged. - Bundles remain
tar.zst/tar.gzwithBUNDLE.txtandBUNDLE.sha256, plus the optionalsnapshot/orsnapshot.btrfspayload, and remain readable by the Bash importer. - Every historical
X_GEN_*,X_HGEN_*,X_PKG_*,X_TS,X_STATE_DIR,X_BINandX_DRY_RUNinput has a flag; environment variables remain the defaults. Flags override environment variables.
The operating-system effects still use the same external tools (btrfs,
mount, tar, gpg, systemctl, the package managers). xgen owns the data
model, validation, state transitions and error handling.
- Changelog
- Architecture
- CLI and flags
- State and schemas
- Bundles
- Home generations
- Declarative system
- Testing
- Migration from the Bash engine
- Security model
- Modularization
- Compatibility audit and integration backlog
GPL-3.0-only, copyright X x@xscriptor.com. The license applies to the contents of this repository only. See LICENSE.