API Documentation
The flk crate is also a library. Build its docs with:
cargo doc --no-deps --open
Modules
flk::flake::generator: templatesgenerate_flake(project_type): profile content for a project typegenerate_slim_flake(),generate_config(default_profile),generate_pins(): files for a new project
flk::flake::parsers: section parserspackages:packages = [ ... ];env:envVars = { ... };commands:commands = [ ... ];shellhook: appending toshellHookoverlays:pins.nixconfig:.flk/config.nixflake: inputs and the combinedFlakeConfigutils: profile resolution and shared combinators
flk::flake::interfaces:FlakeConfig,Profile,Package,EnvVarand the pin typesflk::flake::nix_render:nix_string,nix_attr_keyand other escaping helpersflk::devbox: parsingdevbox.jsonflk::utils::backup:flake.lockbackupsflk::utils::visual: spinner and list output
Example
#![allow(unused)]
fn main() {
use flk::flake::parsers::packages::parse_packages_section;
let path = ".flk/profiles/rust.nix";
let content = std::fs::read_to_string(path)?;
let section = parse_packages_section(&content)?;
let updated = section.add_package(&content, "ripgrep", None);
std::fs::write(path, updated)?;
}
Conventions
- Public items get a
///comment when the name and signature don’t say enough. - Prefix internal or unstable functions with
_. cargo doc --no-depsshould build without new warnings.