Fix nixos-rebuild agent execution: run as cm user

Change sudo command to use '-u cm' to run nixos-rebuild as the cm user
instead of root, allowing access to /home/cm/nixosbox directory.
This commit is contained in:
Christoffer Martinsson 2025-10-24 18:52:51 +02:00
parent 6a1324ba6c
commit 864cafd61f

View File

@ -293,8 +293,10 @@ impl Agent {
info!("Maintenance mode enabled");
}
// Change to nixos directory and execute rebuild
// Change to nixos directory and execute rebuild as cm user
let output = tokio::process::Command::new("sudo")
.arg("-u")
.arg("cm")
.arg("nixos-rebuild")
.arg("switch")
.current_dir(nixos_path)