install: split and harden hardware config scripts
This commit is contained in:
22 files changed
+95
-117
No files matched your search
@@ -1,49 +1,33 @@
|
||||
if lspci | grep -qi 'nvidia'; then
|
||||
# Check which kernel is installed and set appropriate headers package
|
||||
KERNEL_HEADERS="$(pacman -Qqs '^linux(-zen|-lts|-hardened)?$' | head -1)-headers"
|
||||
KERNEL_PACKAGE=$(pacman -Qqs '^linux(-zen|-lts|-hardened|-t2|-ptl)?$' | head -1 || true)
|
||||
[[ -n $KERNEL_PACKAGE ]] && omarchy-pkg-add "$KERNEL_PACKAGE-headers"
|
||||
|
||||
if omarchy-hw-nvidia-gsp; then
|
||||
PACKAGES=(nvidia-open-dkms nvidia-utils lib32-nvidia-utils libva-nvidia-driver)
|
||||
GPU_ARCH="turing_plus"
|
||||
elif omarchy-hw-nvidia-without-gsp; 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[@]}"
|
||||
omarchy-pkg-add "${PACKAGES[@]}"
|
||||
|
||||
# Per-user Hyprland NVIDIA env vars are handled by nvidia-user.sh.
|
||||
|
||||
# Configure modprobe for early KMS
|
||||
sudo tee /etc/modprobe.d/nvidia.conf <<EOF >/dev/null
|
||||
mkdir -p /etc/modprobe.d
|
||||
cat > /etc/modprobe.d/nvidia.conf <<'EOF'
|
||||
options nvidia_drm modeset=1
|
||||
EOF
|
||||
|
||||
# Configure mkinitcpio for early loading
|
||||
sudo tee /etc/mkinitcpio.conf.d/nvidia.conf <<EOF >/dev/null
|
||||
mkdir -p /etc/mkinitcpio.conf.d
|
||||
cat > /etc/mkinitcpio.conf.d/nvidia.conf <<'EOF'
|
||||
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.lua" <<'EOF'
|
||||
|
||||
-- NVIDIA (Turing+ with GSP firmware)
|
||||
hl.env("NVD_BACKEND", "direct")
|
||||
hl.env("LIBVA_DRIVER_NAME", "nvidia")
|
||||
hl.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.lua" <<'EOF'
|
||||
|
||||
-- NVIDIA (Maxwell/Pascal/Volta without GSP firmware)
|
||||
hl.env("NVD_BACKEND", "egl")
|
||||
hl.env("__GLX_VENDOR_LIBRARY_NAME", "nvidia")
|
||||
EOF
|
||||
fi
|
||||
fi
|
||||
Reference in new issue
Block a user