Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

API Documentation

The flk crate is also a library. Build its docs with:

cargo doc --no-deps --open

Modules

  • flk::flake::generator: templates
    • generate_flake(project_type): profile content for a project type
    • generate_slim_flake(), generate_config(default_profile), generate_pins(): files for a new project
  • flk::flake::parsers: section parsers
    • packages: packages = [ ... ];
    • env: envVars = { ... };
    • commands: commands = [ ... ];
    • shellhook: appending to shellHook
    • overlays: pins.nix
    • config: .flk/config.nix
    • flake: inputs and the combined FlakeConfig
    • utils: profile resolution and shared combinators
  • flk::flake::interfaces: FlakeConfig, Profile, Package, EnvVar and the pin types
  • flk::flake::nix_render: nix_string, nix_attr_key and other escaping helpers
  • flk::devbox: parsing devbox.json
  • flk::utils::backup: flake.lock backups
  • flk::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-deps should build without new warnings.