Crate nix_installer
source ·Expand description
The Determinate Nix Installer
nix-installer
breaks down into three main concepts:
Action
: An executable or revertable step, possibly orchestrating sub-Action
s using things likeJoinSet
s.InstallPlan
: A set ofAction
s, along with some metadata, which can be carried out to drive an install or revert.Planner
: Something which can be used to plan out anInstallPlan
.
It is possible to create custom Action
s and Planner
s to suit the needs of your project, team, or organization.
In the simplest case, nix-installer
can be asked to determine a default plan for the platform and install
it, uninstalling if anything goes wrong:
use std::error::Error;
use nix_installer::InstallPlan;
let mut plan = InstallPlan::default().await?;
match plan.install(None).await {
Ok(()) => tracing::info!("Done"),
Err(e) => {
match e.source() {
Some(source) => tracing::error!("{e}: {}", source),
None => tracing::error!("{e}"),
};
plan.uninstall(None).await?;
},
};
Sometimes choosing a specific planner is desired:
use std::error::Error;
use nix_installer::{InstallPlan, planner::Planner};
#[cfg(target_os = "linux")]
let planner = nix_installer::planner::steam_deck::SteamDeck::default().await?;
#[cfg(target_os = "macos")]
let planner = nix_installer::planner::macos::Macos::default().await?;
// Or call `crate::planner::BuiltinPlanner::default()`
// Match on the result to customize.
// Customize any settings...
let mut plan = InstallPlan::plan(planner).await?;
match plan.install(None).await {
Ok(()) => tracing::info!("Done"),
Err(e) => {
match e.source() {
Some(source) => tracing::error!("{e}: {}", source),
None => tracing::error!("{e}"),
};
plan.uninstall(None).await?;
},
};
Modules§
- CLI argument structures and utilities
- Diagnostic reporting functionality
BuiltinPlanner
s and traits to create new types which can be used to plan out anInstallPlan
- Configurable knobs and their related errors
Structs§
- A set of
Action
s, along with some metadata, which can be carried out to drive an install or revert
Enums§
- An error occurring during a call defined in this crate