diff options
| author | Craig Jennings <c@cjennings.net> | 2026-01-17 18:51:00 -0600 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-01-17 18:51:00 -0600 |
| commit | c55fa4923af603644fcadeb33138a64f4b9e9bbb (patch) | |
| tree | 8ec0ce1c9d1e80fb31909fe9416bcd98518ac0ae | |
| parent | 639067a2eb2f3fb378d748324a11dfec586754bc (diff) | |
feat(archsetup): add GPU driver detection and installation
- Detect Intel, AMD, and NVIDIA GPUs via lspci
- Install appropriate drivers and hardware video acceleration
- Support multiple GPUs (e.g., hybrid Intel+NVIDIA laptops)
- Add --no-gpu-drivers flag to skip (useful for VMs)
- Use nvidia-dkms for better kernel compatibility
- Add fallback to mesa+vesa for unknown hardware
| -rwxr-xr-x | archsetup | 56 |
1 files changed, 55 insertions, 1 deletions
@@ -31,6 +31,7 @@ fi skip_slow_packages=false fresh_install=false show_status_only=false +skip_gpu_drivers=false while [ $# -gt 0 ]; do case "$1" in @@ -46,6 +47,10 @@ while [ $# -gt 0 ]; do show_status_only=true shift ;; + --no-gpu-drivers) + skip_gpu_drivers=true + shift + ;; --help|-h) echo "Usage: $0 [OPTIONS]" echo "" @@ -53,12 +58,13 @@ while [ $# -gt 0 ]; do echo " --skip-slow-packages Skip texlive-meta and topgrade" echo " --fresh Start fresh, ignore previous progress" echo " --status Show installation progress and exit" + echo " --no-gpu-drivers Skip GPU driver detection/installation" echo " --help, -h Show this help message" exit 0 ;; *) echo "Unknown option: $1" - echo "Usage: $0 [--skip-slow-packages] [--fresh] [--status]" + echo "Usage: $0 [--skip-slow-packages] [--fresh] [--status] [--no-gpu-drivers]" exit 1 ;; esac @@ -331,6 +337,49 @@ is_zfs_root() { [ "$(findmnt -n -o FSTYPE /)" = "zfs" ] } +# GPU Driver Installation +install_gpu_drivers() { + if $skip_gpu_drivers; then + display "task" "Skipping GPU driver installation (--no-gpu-drivers)" + return 0 + fi + + display "subtitle" "GPU Drivers" + + # Detect GPU vendors via lspci + gpu_info=$(lspci 2>/dev/null | grep -E "VGA|3D") + + if echo "$gpu_info" | grep -qi "intel"; then + display "task" "Intel GPU detected - installing drivers" + pacman_install mesa + pacman_install intel-media-driver # hardware video acceleration + pacman_install vulkan-intel # Vulkan support + fi + + if echo "$gpu_info" | grep -qi "amd\|radeon"; then + display "task" "AMD GPU detected - installing drivers" + pacman_install mesa + pacman_install xf86-video-amdgpu + pacman_install vulkan-radeon + pacman_install libva-mesa-driver # hardware video acceleration + fi + + if echo "$gpu_info" | grep -qi "nvidia"; then + display "task" "NVIDIA GPU detected - installing drivers" + pacman_install nvidia-dkms # DKMS version for kernel flexibility + pacman_install nvidia-utils + pacman_install nvidia-settings + pacman_install libva-nvidia-driver # hardware video acceleration + fi + + # Fallback for VMs or unknown hardware + if ! echo "$gpu_info" | grep -qiE "intel|amd|radeon|nvidia"; then + display "task" "No discrete GPU detected - installing generic drivers" + pacman_install mesa + pacman_install xf86-video-vesa + fi +} + ### Prerequisites prerequisites() { # why these software packages are 'required' @@ -885,6 +934,9 @@ EndSection EOF action="configuring xorg server" && display "task" "$action" chmod 644 /etc/X11/xorg.conf.d/00-no-vt-or-zap.conf >> "$logfile" 2>&1 || error "error" "$action" "$?" + + # Install GPU-specific drivers + install_gpu_drivers } ### DWM Window Manager @@ -1356,6 +1408,8 @@ EOF echo "blacklist iTCO_wdt" >/etc/modprobe.d/nowatchdog.conf || error "error" "$action" "$?" # GRUB: reset timeouts, adjust log levels, larger menu for HiDPI screens, and show splashscreen + # Note: nvme.noacpi=1 disables NVMe ACPI power management to prevent freezes on some drives. + # Safe to keep on newer drives (minor power cost), remove if battery life is critical. action="configuring boot menu for silence and bootsplash" && display "task" "$action" if [ -f /etc/default/grub ]; then action="resetting timeouts and adjusting log levels on grub boot" && display "task" "$action" |
