Skip to content
equislinuxPublic

About

Rust generation manager for X Linux: bootable btrfs snapshots, rollback, home dotfile generations, signed/encrypted bundles and systemd-boot/GRUB entries.

Topics

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

xgen

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.

Status

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 auto and xgen home auto);
  • dir and btrfs backends, systemd-boot and GRUB entries, multi-kernel capture;
  • signed and encrypted bundles with metadata or snapshot data.

Build and test

./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 test

The development workflow used in this repository keeps all temporary state inside the workspace:

export CARGO_HOME="$PWD/.cargo"
export TMPDIR="$PWD/.tmp"
cargo test --workspace

The 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.

Quick start (directory backend)

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 list

Layout

xgen/
  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

Compatibility contract

  • State layout, manifest schema 2 and home manifest schema 1 are unchanged.
  • Boot entry names and the shared kernel store under x/kernels are unchanged.
  • Bundles remain tar.zst/tar.gz with BUNDLE.txt and BUNDLE.sha256, plus the optional snapshot/ or snapshot.btrfs payload, and remain readable by the Bash importer.
  • Every historical X_GEN_*, X_HGEN_*, X_PKG_*, X_TS, X_STATE_DIR, X_BIN and X_DRY_RUN input 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.

Documentation

License

GPL-3.0-only, copyright X x@xscriptor.com. The license applies to the contents of this repository only. See LICENSE.

Contributing and security

About

Rust generation manager for X Linux: bootable btrfs snapshots, rollback, home dotfile generations, signed/encrypted bundles and systemd-boot/GRUB entries.

Topics

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages