fomod-oxide
A Rust library for parsing and evaluating FOMOD mod installer configurations.
FOMOD is an XML-based format used by mod managers (Mod Organizer 2, Vortex, etc.) to define guided installation wizards for game mods.
Features
- Full FOMOD XML parsing —
ModuleConfig.xmlandinfo.xmldeserialization viaquick-xml+serde - Condition evaluation — composite AND/OR dependency trees over file states, flags, game version, and nested conditions
- Interactive installer — step-through API with visibility conditions, group constraint validation (
SelectExactlyOne,SelectAtMostOne,SelectAtLeastOne,SelectAll,SelectAny), and automatic flag propagation on selection - Install plan resolution & execution — collects file operations from required files, selected plugins, and conditional file installs, sorted by priority; execute the plan to copy files into a target directory
- Declarative configuration — skip the interactive wizard entirely by specifying all selections upfront as a name-based config; includes SRI hash integrity verification (nixpkgs
rev/hashpattern), schema versioning, and automatic default/all-options template generation - Nix output (
nixfeature) — serialize declarative configs to Nix expressions or NixOS module fragments viaronix - CLI (
clifeature) — generate declarative configs from FOMOD installers in Nix, RON, or JSON format
Usage
Library
use ;
// Parse the installer configuration
let xml = read_to_string?;
let config = parse?;
// Create an installer and walk through steps
let mut installer = new;
for in installer.visible_steps
// Record selections and resolve the install plan
installer.select;
let plan = installer.resolve;
for op in &plan.operations
Declarative mode
Generate a config template, then load and apply it to install without interaction:
use Path;
use ;
let xml = read_to_string?;
let config = parse?;
// Generate a template with default selections and save it
let decl = from_defaults;
write?;
// Later: load the config and install non-interactively
let decl = from_json?;
let mut installer = new;
decl.apply?;
let plan = installer.resolve;
plan.execute?;
CLI
# Generate a Nix declarative config (default selections)
# Generate with all options listed, output as JSON
# Specify rev and output file
Cargo features
| Feature | Description |
|---|---|
json |
JSON serialization/deserialization for declarative configs |
ron |
RON serialization/deserialization for declarative configs |
nix |
Nix expression output via ronix |
cli |
Builds the fomod-oxide binary (enables json, ron, nix, clap) |
CI
Woodpecker CI on Codeberg runs nix flake check (build, tests, clippy, fmt) on every push and pull request.
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.