fin for real?

This commit is contained in:
2025-10-14 22:40:02 -05:00
parent 4d3935527b
commit 0c4008b544

View File

@@ -28,22 +28,34 @@ in {
active="\033[1;34m"
inactive="\033[1;31m"
headings="\033[0;36m"
bold="\e[1m"
reset="\033[0m"
memory=`free -m | awk 'NR==2{printf "%s/%sMB (%.2f%%)\n", $3,$2,$3*100 / $2 }'`
uptime=`cat /proc/uptime | cut -f1 -d.`
up_days=$((uptime/60/60/24))
up_hours=$((uptime/60/60%24))
up_mins=$((uptime/60%60))
up_secs=$((uptime%60))
printf "$bold Welcome to $(hostname)!$reset\n"
printf "\n"
printf "$bold * %-20s$reset %s\n" "Release" "$PRETTY_NAME"
printf "$bold * %-20s$reset %s\n" "Kernel" "$(uname -rs)"
printf "\n"
printf "$bold * %-20s$reset %s\n" "CPU usage" "$LOAD1, $LOAD5, $LOAD15 (1, 5, 15 min)"
printf "$bold * %-20s$reset %s\n" "Memory" "$memory"
printf "$bold * %-20s$reset %s\n" "System uptime" "$up_days days $up_hours hours $up_mins minutes $up_secs seconds"
printf "\n"
printf "$bold Service status$reset\n"
# --- System Info ---
default_iface=$(ip route | awk '/default/ {print $5; exit}')
ip_addr=$(ip -4 addr show "''${default_iface}" | awk '/inet / {print $2}' | cut -d/ -f1)
nixos_version=$(grep '^VERSION=' /etc/os-release | cut -d'"' -f2 | tr -d '\n')
kernel_version=$(uname -r)
echo -e "''${headings}System Info''${reset}"
echo -e " Hostname: $(hostname)"
echo -e " Interface: ''${default_iface}"
echo -e " IPv4: ''${ip_addr}"
echo -e " NixOS: ''${nixos_version}"
echo -e " Kernel: ''${kernel_version}"
echo
# --- Resource Stats ---
cpu_usage=$(top -bn1 | grep "Cpu(s)" | awk '{print 100 - $8 "%"}')
mem_total=$(grep MemTotal /proc/meminfo | awk '{print $2}')
@@ -58,7 +70,7 @@ in {
echo -e " Uptime: ''${uptime_fmt}"
echo
# --- Homelab Services ---
# --- services ---
echo -e "''${headings}Homelab Services''${reset}"
${lib.concatStringsSep "\n" (map (service: ''