Verify the nix store before starting a build run.

This commit is contained in:
Tom Alexander
2026-07-31 19:26:46 -04:00
parent 3aad35950e
commit 6386febdb8
4 changed files with 216 additions and 0 deletions

View File

@@ -9,6 +9,7 @@ use crate::Result;
use crate::database::db_handle::DbHandle;
use super::RunningUpdate;
use super::RunningVerify;
use super::running_build::RunningBuild;
pub(crate) async fn nixos_build_target<B, F, A, TN>(
@@ -87,3 +88,26 @@ where
Ok(())
}
pub(crate) async fn nix_store_verify_repair_check_contents() -> Result<()> {
let mut command = Command::new("nix-store");
command.stdout(Stdio::piped());
command.stderr(Stdio::piped());
command.stdin(Stdio::null());
command.args([
"--verify",
"--check-contents",
"--repair",
"--log-format",
"internal-json",
"-vvvvvvvvvvv",
]);
command.kill_on_drop(true);
let child = command.spawn()?;
let mut running_verify = RunningVerify::new()?;
running_verify.run_to_completion(child).await?;
Ok(())
}