use thiserror::Error;
#[derive(Error, Debug)]
pub enum NixError {
#[error("Nix is not installed or not in PATH")]
NixNotFound,
#[error("Nix command failed: {0}")]
NixCommandFailed(String),
#[error("Flake not found at path: {0}")]
FlakeNotFound(String),
#[error("Invalid flake.lock format: {0}")]
InvalidFlakeLock(String),
#[error("Attic is not configured")]
AtticNotConfigured,
#[error("Attic command failed: {0}")]
AtticCommandFailed(String),
#[error("Environment not found in cache: {0}")]
EnvironmentNotCached(String),
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
#[error("JSON parsing error: {0}")]
Json(#[from] serde_json::Error),
#[error("HTTP error: {0}")]
Http(String),
#[error("Hash computation failed: {0}")]
HashError(String),
}
impl From<reqwest::Error> for NixError {
fn from(err: reqwest::Error) -> Self {
NixError::Http(err.to_string())
}
}