Santa Data
Data models, schemas, and CCL configuration parser for the Santa package manager.
This library provides the core data structures and configuration parsing functionality used by Santa. It's designed to be reusable for other tools that need to work with Santa's configuration format or data models.
Features
- CCL Configuration Parser - Parse Santa's CCL-based configuration files
- Data Models - Strongly-typed models for packages, sources, and configuration
- Serde Integration - Full serialization/deserialization support
- Validation - Built-in validation for configuration data
- Builder Patterns - Ergonomic builders for constructing data models
Installation
Add to your Cargo.toml:
[]
= "0.1"
Usage
Parse CCL Configuration
use parse_ccl_config;
let ccl = r#"
sources =
= brew
= cargo
= apt
packages =
= ripgrep
= bat
= fd
"#;
let config = parse_ccl_config?;
println!;
println!;
Work with Data Models
use ;
// Define package sources
let sources = vec!;
// Create a package reference
let package = new;
Use Configuration Builder
use ConfigBuilder;
let config = default
.sources
.packages
.cache_ttl_seconds
.build?;
Validation
use Config;
use Validate;
let config = from_ccl?;
config.validate?; // Validates sources, packages, cache settings
Data Models
Core Types
Config- Main configuration structure with sources, packages, and settingsPackageSource- Enumeration of supported package managers (Brew, Cargo, APT, etc.)Package- Package reference with optional metadataCacheConfig- Cache settings (TTL, size limits)
Configuration Schema
The library provides JSON Schema support for validation and documentation:
use generate_config_schema;
let schema = generate_config_schema;
println!;
CCL Format
Santa Data uses CCL (Categorical Configuration Language) for configuration files. CCL is a simple, indentation-based format:
/= This is a comment
/= List items use empty keys with indentation
sources =
= brew
= cargo
= apt
packages =
= ripgrep
= bat
= fd
/= Nested configuration
cache =
ttl_seconds = 3600
max_size = 1000
Integration with Sickle
Santa Data uses the sickle crate for CCL parsing, which provides:
- Pure Rust CCL parser
- Serde integration
- Memory-efficient parsing
- Comprehensive error reporting
API Documentation
For complete API documentation, see docs.rs/santa-data.
Key Modules
models- Core data structures (Config, Package, PackageSource)parser- CCL parsing utilitiesconfig- Configuration builders and loadersschemas- JSON Schema generation
Examples
See the examples directory for complete usage examples:
parse_config.rs- Parse CCL configuration filesbuild_config.rs- Build configuration programmaticallyvalidate_config.rs- Validate configuration data
Run examples with:
Development
Testing
# Run all tests
# Run with output
# Run specific test
Documentation
# Generate and open docs
# Check docs for warnings
Contributing
Contributions are welcome! This library is part of the Santa workspace.
Please ensure:
- Tests pass:
cargo test - Code is formatted:
cargo fmt - Lints pass:
cargo clippy
License
Licensed under the MIT License.
Related Crates
Part of the Santa package manager project.