Fix nixos-rebuild permission issue by running as root directly

Remove sudo -u cm wrapper that was causing git repository ownership
mismatch. Now cm-agent runs nixos-rebuild directly as root, avoiding
the ownership conflict between cm-agent (git clone) and cm user.

Updated sudo rules to allow cm-agent -> root nixos-rebuild access.
This commit is contained in:
Christoffer Martinsson 2025-10-25 00:45:50 +02:00
parent a991fbb942
commit 996a199050

View File

@ -300,8 +300,6 @@ impl Agent {
let rebuild_result = if git_result.is_ok() { let rebuild_result = if git_result.is_ok() {
info!("Git repository ready, executing nixos-rebuild"); info!("Git repository ready, executing nixos-rebuild");
tokio::process::Command::new("sudo") tokio::process::Command::new("sudo")
.arg("-u")
.arg("cm")
.arg("/run/current-system/sw/bin/nixos-rebuild") .arg("/run/current-system/sw/bin/nixos-rebuild")
.arg("switch") .arg("switch")
.arg("--flake") .arg("--flake")