From c27b4dde7081d689d0d9599c87f2b035468f4e9f Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Tue, 26 Mar 2024 16:38:18 -0500 Subject: [PATCH] actually use pixos-rebuild unless asked otherwise --- pkgs/oizys-rs/src/main.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pkgs/oizys-rs/src/main.rs b/pkgs/oizys-rs/src/main.rs index 7183f0f..05af30d 100644 --- a/pkgs/oizys-rs/src/main.rs +++ b/pkgs/oizys-rs/src/main.rs @@ -83,6 +83,9 @@ impl Oizys { (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) { println!("executing: {}", format!("{:?}", cmd).replace('"', "")); } @@ -105,8 +108,13 @@ impl Oizys { fn nixos_rebuild(self: &Oizys, subcommand: &str) { let flake_output = format!("{}#{}", self.flake.to_string_lossy(), self.host); - let mut cmd = Command::new("nixos-rebuild"); - cmd.arg(subcommand).arg(flake_output); + let mut cmd = Command::new("sudo"); + cmd.args([ + &self.nixos_rebuild_cmd(), + subcommand, + "--flake", + &flake_output, + ]); if self.verbose >= 2 { self.show_cmd(&cmd); }