Something went wrong. Try again.
Small (but incredibly useful!) scripts and utilities that don't need their own repo.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142#!/usr/bin/env nu# SPDX-License-Identifier: AGPL-3.0-only# Copyright (c) 2025 MatrixFurry <matrix@matrixfurry.com>
use std/log
# Detect issues with the GPU.## This was created for my own use on a Framework Laptop 16 with an external dock.# Sometimes, the external GPU will have issues caused by my hacky m.2 to oculink adapter.## I can't guarantee this will work for you, but it does reliably detect when there is an issue on my system.export def main [] { let vkinfo = vulkaninfo --summary o+e>| $in
if ($vkinfo | str contains "Could not open device /dev/dri/renderD128") or ($vkinfo | str contains "failed to open device /dev/dri/renderD128") { report "Could not access GPU rendering subsystem" }
if ($vkinfo | lines | parse " deviceType{whitespace}= {device_type}" | where device_type == "PHYSICAL_DEVICE_TYPE_DISCRETE_GPU" | length) == 0 { report "Discrete GPU not found" }}
def report [ message: string] { log warning $"GPU Issue Detected: ($message)" job spawn { match (notify-send -u critical "GPU Issue Detected" $message -A reboot="Reboot") { reboot => (systemctl reboot) } } null}