| Crates.io | cf-modkit-node-info |
| lib.rs | cf-modkit-node-info |
| version | 0.1.0 |
| created_at | 2026-01-25 19:18:56.085454+00 |
| updated_at | 2026-01-25 19:18:56.085454+00 |
| description | ModKit node info library |
| homepage | |
| repository | https://github.com/hypernetix/hyperspot |
| max_upload_size | |
| id | 2069379 |
| size | 78,184 |
A standalone library for collecting system information about the current node where code is executed.
This library provides comprehensive system information collection without any transport layer dependencies. It can be used by any Hyperspot module that needs to gather information about the execution environment.
use modkit_node_info::{get_hardware_uuid, NodeInfoCollector, Node, NodeSysInfo, NodeSysCap, SysCap};
// Get permanent hardware-based UUID for this machine
let node_id = get_hardware_uuid(); // Returns Uuid directly (no Result)
// Create collector
let collector = NodeInfoCollector::new();
// Create a Node instance for the current machine
let node = collector.create_current_node();
// Collect system information
let sysinfo = collector.collect_sysinfo(node.id)?;
// Collect system capabilities (with cache metadata)
let syscap = collector.collect_syscap(node.id)?;
// Collect both sysinfo and syscap in one call
let (sysinfo, syscap) = collector.collect_all(node.id)?;
The get_hardware_uuid() function returns a permanent UUID based on the machine's hardware identifiers:
IOPlatformUUID from IOKit (already a UUID)/etc/machine-id or /var/lib/dbus/machine-id (converted to UUID)MachineGuid from registry (already a UUID)If hardware detection fails, returns a hybrid UUID pattern:
00000000-0000-0000-xxxx-xxxxxxxxxxxxSystem capabilities use different cache TTLs based on change frequency:
| Capability Type | TTL | Reason |
|---|---|---|
| Architecture | 1 hour | Never changes |
| RAM | 5 seconds | Changes frequently |
| CPU | 10 minutes | Rarely changes |
| OS | 2 minutes | Rarely changes |
| GPU | 10 seconds | Can change (hot-plug) |
| Battery | 3 seconds | Very dynamic |
use modkit_node_info::NodeInfoCollector;
let collector = NodeInfoCollector::new();
let node = collector.create_current_node();
let sysinfo = collector.collect_sysinfo(node.id)?;
let syscap = collector.collect_syscap(node.id)?;
println!("Node: {} ({})", node.hostname, node.id);
println!("CPU: {} cores", sysinfo.cpu.cores);
println!("Memory: {} GB used", sysinfo.memory.used_bytes / 1024 / 1024 / 1024);
let syscap = collector.collect_syscap(node.id)?;
for cap in syscap.capabilities {
if cap.present {
println!("{}: {} ({})",
cap.display_name,
cap.amount.unwrap_or(0.0),
cap.amount_dimension.unwrap_or_else(|| "N/A".to_string())
);
}
}
NVIDIA GPUs (Linux & Windows):
nvml-wrapper cratenvidia-smiOther GPUs:
system_profiler SPDisplaysDataType for all GPUslspci for AMD/Intel GPUswmic Win32_VideoController for AMD/Intel GPUsDetection Strategy:
starship-battery crate for cross-platform battery informationNone for desktop systems without batteriessysinfo - System information collectionmachine-uid - Hardware UUID detectionlocal-ip-address - Local IP detectionstarship-battery - Battery informationnvml-wrapper - NVIDIA GPU detection (Linux & Windows)regex - GPU parsing (macOS)chrono - Timestampsuuid - Node IDsThis library is designed to be used by the nodes_registry module and any other module that needs to collect information about the current execution environment.
[dependencies]
modkit-node-info = { path = "../../libs/modkit-node-info" }
modkit-node-info/
├── src/
│ ├── lib.rs # Public exports
│ ├── error.rs # NodeInfoError
│ ├── model.rs # All data models
│ ├── collector.rs # NodeInfoCollector
│ ├── hardware_uuid.rs # Hardware UUID detection
│ ├── sysinfo_collector.rs # System info collection
│ ├── syscap_collector.rs # Capabilities collection
│ ├── gpu_collector_macos.rs # macOS GPU detection
│ ├── gpu_collector_linux.rs # Linux GPU detection
│ └── gpu_collector_windows.rs # Windows GPU detection
└── Cargo.toml