mirror of
https://github.com/arthur-pbty/arthur-os.git
synced 2026-08-02 04:37:49 +02:00
Evaluate NVIDIA session env vars from default/hypr/nvidia.lua during Hyprland startup instead of appending them to each user's envs.lua during setup. This removes the per-user NVIDIA setup script execution while preserving the GSP/non-GSP detection.
34 lines
1.1 KiB
Bash
34 lines
1.1 KiB
Bash
if lspci | grep -qi 'nvidia'; then
|
|
# Check which kernel is installed and set appropriate headers package
|
|
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)
|
|
elif omarchy-hw-nvidia-without-gsp; then
|
|
PACKAGES=(nvidia-580xx-dkms nvidia-580xx-utils lib32-nvidia-580xx-utils)
|
|
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 "${PACKAGES[@]}"
|
|
|
|
# Per-session Hyprland NVIDIA env vars are handled by default/hypr/nvidia.lua.
|
|
|
|
# Configure modprobe for early KMS
|
|
mkdir -p /etc/modprobe.d
|
|
cat > /etc/modprobe.d/nvidia.conf <<'EOF'
|
|
options nvidia_drm modeset=1
|
|
EOF
|
|
|
|
# Configure mkinitcpio for early loading
|
|
mkdir -p /etc/mkinitcpio.conf.d
|
|
cat > /etc/mkinitcpio.conf.d/nvidia.conf <<'EOF'
|
|
MODULES+=(nvidia nvidia_modeset nvidia_uvm nvidia_drm)
|
|
EOF
|
|
fi
|