diff --git a/flake.nix b/flake.nix index f39eeea..2162a13 100644 --- a/flake.nix +++ b/flake.nix @@ -98,7 +98,7 @@ rust-project TODO: write shell script for automatically updating `cargoHash` serviceConfig = { Type = "oneshot"; ExecStart = '' - ${cfg.package}/bin/status_cloud --config-file ${builtins.toString cfg.config_path} + ${cfg.package}/bin/status_cloud --hddtemp-executable ${pkg.hddtemp} --config-file ${builtins.toString cfg.config_path} ''; }; }; diff --git a/status_cloud/src/main.rs b/status_cloud/src/main.rs index 2579672..6614975 100644 --- a/status_cloud/src/main.rs +++ b/status_cloud/src/main.rs @@ -60,10 +60,11 @@ fn main() -> Result<(), Box> { } } - match Command::new("hddtemp").output() { + match Command::new(args.hddtemp_executable.clone()).output() { Ok(val) => val, Err(e) => { println!("Error running hddtemp at all: {}", e.to_string()); + println!("hddtemp = {}", args.hddtemp_executable.clone()); return Ok(()); } }; @@ -72,7 +73,7 @@ fn main() -> Result<(), Box> { let mut drive_temps: Vec = vec![]; for drive in drives { - let output = match Command::new("hddtemp").arg(drive.clone()).output() { + let output = match Command::new(args.hddtemp_executable.clone()).arg(drive.clone()).output() { Ok(val) => val, Err(e) => { println!("Error running hddtemp: {}", e.to_string()); @@ -154,4 +155,7 @@ struct CliArgs { /// Path to config .toml file #[arg(short, long)] config_file: String, + + #[arg(short, long)] + hddtemp_executable: String, }