diff --git a/dashboard/src/main.rs b/dashboard/src/main.rs index ec9de87..c055e10 100644 --- a/dashboard/src/main.rs +++ b/dashboard/src/main.rs @@ -11,19 +11,14 @@ mod ui; use app::Dashboard; -/// Get version showing current system config hash for easy rebuild verification +/// Get version showing cm-dashboard package hash for easy rebuild verification fn get_version() -> &'static str { - use std::process::Command; + // Get the path of the current executable + let exe_path = std::env::current_exe().expect("Failed to get executable path"); + let exe_str = exe_path.to_string_lossy(); - // Get config hash from current system - let output = Command::new("readlink").arg("/run/current-system").output().expect("Failed to run readlink"); - assert!(output.status.success(), "readlink command failed"); - - let store_path = String::from_utf8_lossy(&output.stdout); - let store_path = store_path.trim(); - - // Extract hash from nix store path - let hash_part = store_path.strip_prefix("/nix/store/").expect("Not a nix store path"); + // Extract Nix store hash from path like /nix/store/HASH-cm-dashboard-0.1.0/bin/cm-dashboard + let hash_part = exe_str.strip_prefix("/nix/store/").expect("Not a nix store path"); let hash = hash_part.split('-').next().expect("Invalid nix store path format"); assert!(hash.len() >= 8, "Hash too short");