pub struct DeclarativeConfig {
pub schema_version: u32,
pub rev: String,
pub hash: String,
pub selections: HashMap<String, HashMap<String, Vec<String>>>,
}Expand description
Declarative FOMOD installation configuration.
Instead of stepping through an interactive wizard, all selections are specified upfront by name. This makes FOMOD installations reproducible and compatible with declarative systems like NixOS.
Uses the nixpkgs rev + hash pattern: rev is a human-readable
version identifier and hash is an SRI hash of the installer XML
for integrity verification.
§Structure
{
schema_version = 1;
rev = "1.2.0";
hash = "sha256-xbenkdP6HEXuWl9K...";
selections = {
"Choose Version" = {
"Platform" = [ "SSE" ];
};
};
}Fields§
§schema_version: u32Schema version of this config format. See SCHEMA_VERSION.
rev: StringHuman-readable revision of the FOMOD installer (e.g. mod version).
Sourced from info.xml when available, otherwise the module name.
hash: StringSRI hash of the source FOMOD XML (sha256-<base64>).
Follows the nixpkgs convention. Used to detect when the upstream installer has changed and this config may need to be regenerated.
selections: HashMap<String, HashMap<String, Vec<String>>>Step name → group name → list of selected plugin names.
Implementations§
Source§impl DeclarativeConfig
impl DeclarativeConfig
Sourcepub fn from_defaults(
xml: &str,
rev: impl Into<String>,
config: &ModuleConfig,
) -> Self
pub fn from_defaults( xml: &str, rev: impl Into<String>, config: &ModuleConfig, ) -> Self
Create a template config from a FOMOD module with default selections.
xml: raw XML source used to compute the SRI hashrev: human-readable version identifier (e.g. frominfo.xml)config: parsed FOMOD module configuration
Sourcepub fn from_all(
xml: &str,
rev: impl Into<String>,
config: &ModuleConfig,
) -> Self
pub fn from_all( xml: &str, rev: impl Into<String>, config: &ModuleConfig, ) -> Self
Create a template config with all available options listed.
Every plugin in every group is included, making it easy to see what’s available and remove what you don’t want.
Sourcepub fn apply(
&self,
xml: &str,
installer: &mut Installer,
) -> Result<(), DeclarativeError>
pub fn apply( &self, xml: &str, installer: &mut Installer, ) -> Result<(), DeclarativeError>
Apply this declarative config to an installer, resolving names to indices.
xml is the raw FOMOD XML source, used to verify the installer hash.
Steps not present in selections use default selections. Groups not
present in a step’s map also use defaults. This allows partial configs
where you only override what you care about.
Sourcepub fn summary(&self) -> Vec<SelectionSummary>
pub fn summary(&self) -> Vec<SelectionSummary>
Generate a human-readable summary of all selections.
Sourcepub fn diff(&self, other: &DeclarativeConfig) -> Vec<SelectionDiff>
pub fn diff(&self, other: &DeclarativeConfig) -> Vec<SelectionDiff>
Compute the differences between this config and another.
Trait Implementations§
Source§impl Clone for DeclarativeConfig
impl Clone for DeclarativeConfig
Source§fn clone(&self) -> DeclarativeConfig
fn clone(&self) -> DeclarativeConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more