git.delta.rocks / jrsonnet / refs/commits / dfbdb4ac5bb1

difftreelog

refactor use nix build to update profile generation

Yaroslav Bolyukin2024-11-14parent: #15fd410.patch.diff
in: trunk

1 file changed

modifiedcmds/fleet/src/cmds/build_systems.rsdiffbeforeafterboth
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 // It would also be possible to update profile atomically during copy:
180 // https://github.com/NixOS/nix/pull/11657
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 }