| Crates.io | ix-config |
| lib.rs | ix-config |
| version | 0.1.0 |
| created_at | 2026-01-25 17:56:04.800401+00 |
| updated_at | 2026-01-25 17:56:04.800401+00 |
| description | Hierarchical configuration loading for Ixchel |
| homepage | |
| repository | https://github.com/kevinmichaelchen/ixchel |
| max_upload_size | |
| id | 2069185 |
| size | 55,304 |
Hierarchical configuration loading for Ixchel. Provides a consistent config loading pattern across CLI tools in the ecosystem.
Ixchel tools share common configuration patterns:
~/.ixchel/config/.ixchel/This crate centralizes that logic to avoid divergence.
Ixchel uses a unified ~/.ixchel/ directory for global config/state/data:
~/.ixchel/ # Unified ixchel home
├── config/ # Configuration (user-editable TOML)
│ ├── config.toml # Shared settings (GitHub token, embedding model)
│ └── ixchel.toml # ixchel settings
│
├── data/ # Caches & databases (auto-generated)
├── state/ # Runtime metadata (ephemeral)
└── log/ # Operation logs
Project-local overrides:
{project}/.ixchel/ # Project config + canonical artifacts
├── config.toml # Project shared config
├── ixchel.toml # ixchel project overrides
└── ...
See the Configuration docs for full details.
Priority (highest to lowest):
1. Environment variables (IXCHEL_*, GITHUB_TOKEN, etc.)
2. Global tool config (~/.ixchel/config/<tool>.toml)
3. Global shared config (~/.ixchel/config/config.toml)
4. Project tool config (.ixchel/<tool>.toml)
5. Project shared config (.ixchel/config.toml)
6. Defaults (from Default trait)
use ix_config::{ConfigLoader, load_config};
use serde::Deserialize;
#[derive(Debug, Default, Deserialize)]
struct MyToolConfig {
#[serde(default)]
concurrency: usize,
}
// Simple loading with defaults
let config: MyToolConfig = load_config("my-tool")?;
// Or with more control
let loader = ConfigLoader::new("my-tool");
let config: MyToolConfig = loader
.with_env_prefix("MY_TOOL")
.load()?;
The global ~/.ixchel/config/config.toml contains settings shared across tools:
[github]
token = "ghp_xxx" # Or use GITHUB_TOKEN env var
[embedding]
model = "BAAI/bge-small-en-v1.5"
batch_size = 32
[storage]
backend = "helixdb"
path = "data/ixchel" # relative to .ixchel/
use ix_config::{ixchel_home, ixchel_config_dir, ixchel_data_dir};
// Get the Ixchel home directory
let home = ixchel_home(); // ~/.ixchel
// Get specific subdirectories
let config_dir = ixchel_config_dir(); // ~/.ixchel/config
let data_dir = ixchel_data_dir(); // ~/.ixchel/data
// Tool-specific data directories
let index_dir = ixchel_data_dir().join("index"); // ~/.ixchel/data/index
The crate provides automatic GitHub token detection:
use ix_config::detect_github_token;
if let Some(token) = detect_github_token() {
// Token found from: GITHUB_TOKEN, GH_TOKEN, config, or `gh auth token`
}
Detection order:
GITHUB_TOKEN environment variableGH_TOKEN environment variablegithub.token in config filesgh auth token command output# Override ixchel home directory
export IXCHEL_HOME=~/my-ixchel
# Shared settings
export IXCHEL_GITHUB_TOKEN=ghp_xxx
export IXCHEL_EMBEDDING_MODEL=jina-embeddings-v3
# Tool-specific overrides (using __ for nesting)
export IXCHEL__SYNC__CONCURRENCY=10
| Crate | Notes |
|---|---|
ix-core |
Loads merged Ixchel config |
ix-embeddings |
Reads embedding settings from config |
ix-app |
Selects backends for apps |