Files
omarchy/install/config/hardware/nvidia.sh
johnzfitch a8ce084460 Fix NVIDIA environment variables for Maxwell/Pascal/Volta GPUs
Maxwell, Pascal, and Volta GPUs lack GSP (GPU System Processor) firmware
required by NVD_BACKEND=direct. Applying direct backend unconditionally
causes Aquamarine v3.3.0+ to fail with "Unknown-1" displays and blank screens.

Changes:
- Add GPU generation detection (Turing+ vs Maxwell/Pascal/Volta)
- Turing+ (RTX 20xx+, GTX 16xx): NVD_BACKEND=direct + LIBVA_DRIVER_NAME=nvidia
- Maxwell/Pascal/Volta: NVD_BACKEND=egl only (no GSP support)
- Both generations: __GLX_VENDOR_LIBRARY_NAME=nvidia (universal)

Regex improvements:
- Fix Turing+ detection (was using Maxwell/Pascal pattern)
- GT series: GT 1030 now properly detected (was missed)
- Quadro: P/M series only (exclude Kepler K-series)
- Volta: Titan V, Tesla V100, Quadro GV100
- Modern datacenter: A100, H100, T4, L-series
- MX series: Fixed to match MX150/250/450 (was only MX1-9)

Migration script (1770159912.sh) fixes existing broken installations by:
- Detecting legacy NVIDIA GPUs on existing systems
- Rewriting incompatible NVD_BACKEND=direct entries to egl
- Creating automatic backups before modification

Testing:
Validated against GT 1030, GTX 960/1080, Quadro P620 (legacy egl backend)
and GTX 1650, RTX 3080 (modern direct backend).

Preserves existing Turing+ behavior exactly. No impact on non-NVIDIA systems.

Fixes hyprwm/Hyprland#7001
Fixes hyprwm/Hyprland#8519
Fixes hyprwm/Hyprland#6343
Fixes hyprwm/Hyprland#7812
2026-02-03 17:33:48 -08:00

54 lines
2.1 KiB
Bash

NVIDIA="$(lspci | grep -i 'nvidia')"
if [ -n "$NVIDIA" ]; then
# Check which kernel is installed and set appropriate headers package
KERNEL_HEADERS="$(pacman -Qqs '^linux(-zen|-lts|-hardened)?$' | head -1)-headers"
# Turing+ (GTX 16xx, RTX 20xx-50xx, Quadro RTX, datacenter A/H/T/L series) have GSP firmware
if echo "$NVIDIA" | grep -qE "GTX 16[0-9]{2}|RTX [2-5][0-9]{3}|Quadro RTX|RTX A[0-9]{4}|A[1-9][0-9]{2}|H[1-9][0-9]{2}|T4|L[0-9]+"; then
PACKAGES=(nvidia-open-dkms nvidia-utils lib32-nvidia-utils libva-nvidia-driver)
GPU_ARCH="turing_plus"
# Maxwell (GTX 9xx), Pascal (GT/GTX 10xx, Quadro P, MX series), Volta (Titan V, Tesla V100, Quadro GV100) lack GSP
elif echo "$NVIDIA" | grep -qE "GTX (9[0-9]{2}|10[0-9]{2})|GT 10[0-9]{2}|Quadro [PM][0-9]{3,4}|Quadro GV100|MX *[0-9]+|Titan (X|Xp|V)|Tesla V100"; then
PACKAGES=(nvidia-580xx-dkms nvidia-580xx-utils lib32-nvidia-580xx-utils)
GPU_ARCH="maxwell_pascal_volta"
fi
# Bail if no supported GPU
if [ -z "${PACKAGES+x}" ]; then
echo "No compatible driver for your NVIDIA GPU. See: https://wiki.archlinux.org/title/NVIDIA"
exit 0
fi
omarchy-pkg-add "$KERNEL_HEADERS" "${PACKAGES[@]}"
# Configure modprobe for early KMS
sudo tee /etc/modprobe.d/nvidia.conf <<EOF >/dev/null
options nvidia_drm modeset=1
EOF
# Configure mkinitcpio for early loading
sudo tee /etc/mkinitcpio.conf.d/nvidia.conf <<EOF >/dev/null
MODULES+=(nvidia nvidia_modeset nvidia_uvm nvidia_drm)
EOF
# Add NVIDIA environment variables based on GPU architecture
if [ "$GPU_ARCH" = "turing_plus" ]; then
# Turing+ (RTX 20xx, GTX 16xx, and newer) with GSP firmware support
cat >>$HOME/.config/hypr/envs.conf <<'EOF'
# NVIDIA (Turing+ with GSP firmware)
env = NVD_BACKEND,direct
env = LIBVA_DRIVER_NAME,nvidia
env = __GLX_VENDOR_LIBRARY_NAME,nvidia
EOF
elif [ "$GPU_ARCH" = "maxwell_pascal_volta" ]; then
# Maxwell/Pascal/Volta (GTX 9xx/10xx, GT 10xx, Quadro P/M/GV, MX series, Titan X/Xp/V) lack GSP firmware
cat >>$HOME/.config/hypr/envs.conf <<'EOF'
# NVIDIA (Maxwell/Pascal/Volta without GSP firmware)
env = NVD_BACKEND,egl
env = __GLX_VENDOR_LIBRARY_NAME,nvidia
EOF
fi
fi