Skip to main content

Crate shikumi

Crate shikumi 

Source
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§

ConfigDiscovery
Builder for config file discovery.
ConfigStore
A concurrent, hot-reloadable config store.
ConfigWatcher
A symlink-aware config file watcher.
ProviderChain
Builder for a figment provider chain.

Enums§

Format
Supported config file formats, in preference order.
ShikumiError

Functions§

symlink_target
Resolves a symlink to its canonical target, or returns None if the path is not a symlink.