Expand description
The Determinate Nix Installer
nix-installer breaks down into three main concepts:
Action: An executable or revertable step, possibly orchestrating sub-Actions using things likeJoinSets.InstallPlan: A set ofActions, 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 Actions and Planners 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§
- action
- An executable or revertable step, possibly orchestrating sub-
Actions using things likeJoinSets - cli
- CLI argument structures and utilities
- diagnostics
- Diagnostic reporting functionality
- planner
BuiltinPlanners and traits to create new types which can be used to plan out anInstallPlan- self_
test - settings
- Configurable knobs and their related errors
Structs§
- Install
Plan - A set of
Actions, along with some metadata, which can be carried out to drive an install or revert
Enums§
- Certificate
Error - NixInstaller
Error - An error occurring during a call defined in this crate