Update NixOS display format to show build hash and timestamp
- Change from showing version to build format: 'hash dd/mm/yy H:M:S' - Parse nixos-version output to extract short hash and format date - Update system widget to display 'Build:' instead of 'Version:' - Remove version/build_date fields in favor of single build string - Follow TODO.md specification for NixOS section layout
This commit is contained in:
@@ -14,8 +14,7 @@ use crate::ui::theme::{StatusIcons, Typography};
|
||||
#[derive(Clone)]
|
||||
pub struct SystemWidget {
|
||||
// NixOS information
|
||||
nixos_version: Option<String>,
|
||||
nixos_build_date: Option<String>,
|
||||
nixos_build: Option<String>,
|
||||
active_users: Option<String>,
|
||||
|
||||
// CPU metrics
|
||||
@@ -63,8 +62,7 @@ struct StorageDrive {
|
||||
impl SystemWidget {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
nixos_version: None,
|
||||
nixos_build_date: None,
|
||||
nixos_build: None,
|
||||
active_users: None,
|
||||
cpu_load_1min: None,
|
||||
cpu_load_5min: None,
|
||||
@@ -301,14 +299,9 @@ impl Widget for SystemWidget {
|
||||
for metric in metrics {
|
||||
match metric.name.as_str() {
|
||||
// NixOS metrics
|
||||
"system_nixos_version" => {
|
||||
if let MetricValue::String(version) = &metric.value {
|
||||
self.nixos_version = Some(version.clone());
|
||||
}
|
||||
}
|
||||
"system_nixos_build_date" => {
|
||||
if let MetricValue::String(date) = &metric.value {
|
||||
self.nixos_build_date = Some(date.clone());
|
||||
"system_nixos_build" => {
|
||||
if let MetricValue::String(build) = &metric.value {
|
||||
self.nixos_build = Some(build.clone());
|
||||
}
|
||||
}
|
||||
"system_active_users" => {
|
||||
@@ -390,9 +383,9 @@ impl Widget for SystemWidget {
|
||||
Span::styled("NixOS:", Typography::widget_title())
|
||||
]));
|
||||
|
||||
let version_text = self.nixos_version.as_deref().unwrap_or("unknown");
|
||||
let build_text = self.nixos_build.as_deref().unwrap_or("unknown");
|
||||
lines.push(Line::from(vec![
|
||||
Span::styled(format!("Version: {}", version_text), Typography::secondary())
|
||||
Span::styled(format!("Build: {}", build_text), Typography::secondary())
|
||||
]));
|
||||
|
||||
let users_text = self.active_users.as_deref().unwrap_or("unknown");
|
||||
|
||||
Reference in New Issue
Block a user