nix-conf/home-manager/scripts/lsgpu.sh
Thiago Sposito 095e9f4f6b feat: initialize repo with NixOS and Home Manager configs
- Add .gitignore for common languages, tools, and OS/editor artifacts
- Configure .gitattributes for Git LFS (fonts, images, archives, ISOs)
- Add README with repo description
- Add flake.nix defining inputs and outputs for NixOS, Home Manager, and related modules
- Introduce home-manager configs:
  - Base home.nix with packages, services, and programs
  - Hyprland WM configuration (waybar, fuzzel, keybindings, theming)
  - Vim (nixvim) setup with LSP and plugins
  - Zsh setup with aliases, Oh My Zsh, clipboard helpers
  - Systemd user services (e.g., librespot)
- Add scripts (GPU monitor, RAM build helper, install automation)
- Add host configurations:
  - Nixbook (Apple laptop) with hardware, disko, and install script
  - Nixstation (desktop) with firewall, virtualization, Btrfs scrub timer
  - Nixtest (test VM) with QEMU + Alpine-based install test harness
  - Common modules (network, NVIDIA, rclone, screen, keychron, users)
- Include statix config for linting
2025-08-20 23:49:49 -03:00

37 lines
1.1 KiB
Bash
Executable file

#!/usr/bin/env bash
########################################################################
# 🄯 2025 Thiago Sposito — All rights reversed #
# This script is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License v3.0. #
# See https://www.gnu.org/licenses/gpl-3.0.html for full details. #
########################################################################
clear
if ! command -v nvidia-smi >/dev/null 2>&1; then
echo "non compatible gpu"
exit 1
fi
tput civis
stty -echo -icanon time 0 min 0
trap 'stty sane; tput cnorm; exit' INT TERM EXIT
while true; do
nvidia-smi \
--query-gpu=index,name,temperature.gpu,memory.used,memory.total,utilization.gpu \
--format=csv,noheader,nounits |
awk -F", " '{printf "GPU %s (%s): Temp: %s°C | Mem: %s/%s MiB | Util: %s%%\033[K\n", $1, $2, $3, $4, $5, $6}'
echo
read -n 1 -t 1 first
read -n 1 -t 0.1 second
key="${first}${second}"
if [[ "$key" == "q" || "$key" == ":q" ]]; then
break
fi
echo -en "\033[${LINES}A"
done