Expand description
Shikumi (仕組み) — config discovery, hot-reload, and ArcSwap store for Nix-managed desktop applications.
Extracted from karakuri’s configuration system, shikumi provides the shared infrastructure for desktop apps that need:
- XDG config discovery with env var overrides and format preference
- Figment provider chains (defaults → env vars → config file)
- Lock-free concurrent reads via ArcSwap
- Hot-reload with symlink-aware file watching (for nix-darwin managed configs)
§Quick Start
use serde::Deserialize;
use shikumi::{ConfigDiscovery, ConfigStore, Format};
#[derive(Deserialize, Clone, Debug, Default)]
struct MyConfig {
window_width: Option<u32>,
}
let path = ConfigDiscovery::new("myapp")
.env_override("MYAPP_CONFIG")
.formats(&[Format::Yaml, Format::Toml])
.discover()
.expect("config file not found");
let store = ConfigStore::<MyConfig>::load(&path, "MYAPP_")
.expect("failed to load config");
let config = store.get();
println!("width: {:?}", config.window_width);Structs§
- Config
Discovery - Builder for config file discovery.
- Config
Store - A concurrent, hot-reloadable config store.
- Config
Watcher - A symlink-aware config file watcher.
- Provider
Chain - Builder for a figment provider chain.
Enums§
- Format
- Supported config file formats, in preference order.
- Shikumi
Error
Functions§
- symlink_
target - Resolves a symlink to its canonical target, or returns
Noneif the path is not a symlink.