Alright this ain't finished cause of the home stuff but I don't wanna lose what I've done. Impermanence, disko, lots of changes. TODO: add modularity to home.

This commit is contained in:
Jimbo 2024-11-02 17:19:40 -04:00
parent 7a3f60038b
commit 15ab10152b
109 changed files with 766 additions and 749 deletions

View file

@ -47,15 +47,14 @@
vramModule = {
exec = pkgs.writeScript "vramScript" ''
# Don't run the script if running on integrated graphics
if lspci -k | grep "Kernel driver in use: nvidia" &> /dev/null || lspci -k | grep "Kernel driver in use: amdgpu" &> /dev/null; then
gpu_driver=$(${pkgs.pciutils}/bin/lspci -k | grep -Eo "in use: (nvidia|amdgpu)" | awk '{print $3}')
# Run the nvidia-smi command and capture the VRAM usage and GPU utilization output
if lspci -k | grep "Kernel driver in use: nvidia" &> /dev/null; then
if [ -n "$gpu_driver" ]; then
if [ "$gpu_driver" == "nvidia" ]; then
vram_usage_mb=$(nvidia-smi --query-gpu=memory.used --format=csv,noheader,nounits)
temperature=$(nvidia-smi --query-gpu=temperature.gpu --format=csv,noheader,nounits)
# Check the drm memory if an AMD GPU is present
elif lspci -k | grep "Kernel driver in use: amdgpu" &> /dev/null; then
elif [ "$gpu_driver" == "amdgpu" ]; then
vram_usage_mb=$(echo "$(cat /sys/class/drm/card0/device/mem_info_vram_used || cat /sys/class/drm/card1/device/mem_info_vram_used) / 1024 / 1024" | bc)
temperature=$(sensors | grep 'edge' | awk '{print $2}' | sed 's/[^0-9.-]//g')
fi
@ -69,10 +68,8 @@
vram_usage_display="$(echo $vram_usage_gib)G"
fi
# Print the VRAM usage in MB or GiB, and include GPU utilization and temperature
echo "{\"text\":\"󰢮 $(echo $vram_usage_display)\",\"tooltip\":\"$(echo $temperature)°C\"}"
else
:
# Print the VRAM usage and temperature
echo "{\"text\":\"󰢮 $(echo $vram_usage_display)\",\"tooltip\":\"$(echo $temperature)°C\"}"
fi
'';
format = "{}";