175 }175 }
176176
177 if action.should_switch_profile() && !failed {177 if action.should_switch_profile() && !failed {
178 info!("switching generation");178 info!("switching system profile generation");
179
180
179 let mut cmd = host.cmd("nix-env").await?;181 let mut cmd = host.cmd("nix").await?;
182 cmd.arg("build");
180 cmd.comparg("--profile", "/nix/var/nix/profiles/system")183 cmd.comparg("--profile", "/nix/var/nix/profiles/system");
181 .comparg("--set", &built);184 cmd.arg(&built);
182 if let Err(e) = cmd.sudo().run().await {185 if let Err(e) = cmd.sudo().run_nix().await {
183 error!("failed to switch generation: {e}");186 error!("failed to switch system profile generation: {e}");
184 failed = true;187 failed = true;
185 }188 }
186 }189 }