Skip to content

Commit

Permalink
fix(step/nix-helper): Add support for --yes
Browse files Browse the repository at this point in the history
  • Loading branch information
dtomvan committed Feb 17, 2025
1 parent 3227a96 commit 55ae9fb
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions src/steps/os/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -677,19 +677,29 @@ pub fn run_nix_helper(ctx: &ExecutionContext) -> Result<()> {
if nixos_cfg.is_ok_and(|x| x.contains(&format!(r#""{hostname}""#))) {
print_separator("nh os");

run_type.execute(&nix_helper).arg("os").arg("switch").status_checked()?;
let mut cmd = run_type.execute(&nix_helper);
cmd.arg("os");
cmd.arg("switch");

if !ctx.config().yes(Step::NixHelper) {
cmd.arg("--ask");
}
cmd.status_checked()?;
}

if let Ok(home_cfg) = home_cfg {
let username_at_hostname = format!(r#""{username}@{hostname}""#);
if home_cfg.contains(&format!(r#""{username}""#)) || home_cfg.contains(&username_at_hostname) {
print_separator("nh home");

run_type
.execute(&nix_helper)
.arg("home")
.arg("switch")
.status_checked()?;
let mut cmd = run_type.execute(&nix_helper);
cmd.arg("home");
cmd.arg("switch");

if !ctx.config().yes(Step::NixHelper) {
cmd.arg("--ask");
}
cmd.status_checked()?;
}
}

Expand Down

0 comments on commit 55ae9fb

Please sign in to comment.