Skip to main content

flake_edit/
lib.rs

1//! Edit Nix flake inputs from Rust.
2//!
3//! [`edit::FlakeEdit`] is the entry point: build one with
4//! [`edit::FlakeEdit::from_text`], queue or apply [`change::Change`]s, and read
5//! back the new source via [`edit::FlakeEdit::source_text`] or
6//! [`edit::ApplyOutcome`].
7//!
8//! Supporting modules:
9//! - [`walk`] traverses the `rnix` CST and applies edits.
10//! - [`input`] models a flake input and its [`input::Follows`] declarations.
11//! - [`lock`] parses `flake.lock` for revs, follows targets, and nested input
12//!   discovery via [`lock::FlakeLock::nested_inputs`].
13//! - [`forge`] talks to GitHub / Gitea / Forgejo, normalizes versions, and
14//!   applies pin/unpin updates (`forge::api`, `forge::channel`,
15//!   `forge::version`, `forge::update`).
16//! - [`config`] loads `flake-edit.toml`.
17//! - [`cache`] persists URI completion state.
18//! - [`validate`] runs pre-edit lint passes. [`Error`] is the crate-wide
19//!   error.
20//!
21//! Feature flags: `application` (default) enables the binary-side glue
22//! ([`app`], [`cli`], [`diff`], [`tui`]) and pulls in `clap`, `ratatui`,
23//! `crossterm`, `diffy`, etc. Library-only consumers can disable it with
24//! `--no-default-features` to compile the pure edit / walk / forge surface.
25
26#[cfg(feature = "application")]
27pub mod app;
28pub mod cache;
29pub mod change;
30#[cfg(feature = "application")]
31pub mod cli;
32pub mod config;
33#[cfg(feature = "application")]
34pub mod diff;
35pub mod edit;
36pub mod error;
37pub mod follows;
38pub mod forge;
39pub mod input;
40pub mod lock;
41#[cfg(feature = "application")]
42pub mod tui;
43pub mod uri;
44pub mod validate;
45pub mod walk;
46
47pub use error::Error;