actually use pixos-rebuild unless asked otherwise

This commit is contained in:
Daylin Morgan 2024-03-26 16:38:18 -05:00
parent a7625a12fe
commit c27b4dde70
Signed by: daylin
GPG key ID: 950D13E9719334AD

View file

@ -83,6 +83,9 @@ impl Oizys {
(if self.no_pinix { "nix" } else { "pix" }).to_string() (if self.no_pinix { "nix" } else { "pix" }).to_string()
} }
fn nixos_rebuild_cmd(self: &Oizys) -> String {
self.nix() + "os-rebuild"
}
fn show_cmd(self: &Oizys, cmd: &Command) { fn show_cmd(self: &Oizys, cmd: &Command) {
println!("executing: {}", format!("{:?}", cmd).replace('"', "")); println!("executing: {}", format!("{:?}", cmd).replace('"', ""));
} }
@ -105,8 +108,13 @@ impl Oizys {
fn nixos_rebuild(self: &Oizys, subcommand: &str) { fn nixos_rebuild(self: &Oizys, subcommand: &str) {
let flake_output = format!("{}#{}", self.flake.to_string_lossy(), self.host); let flake_output = format!("{}#{}", self.flake.to_string_lossy(), self.host);
let mut cmd = Command::new("nixos-rebuild"); let mut cmd = Command::new("sudo");
cmd.arg(subcommand).arg(flake_output); cmd.args([
&self.nixos_rebuild_cmd(),
subcommand,
"--flake",
&flake_output,
]);
if self.verbose >= 2 { if self.verbose >= 2 {
self.show_cmd(&cmd); self.show_cmd(&cmd);
} }