Skip to content

Commit

Permalink
profiles/graphic_drivers: Add open nvidia modules profiles (#127)
Browse files Browse the repository at this point in the history
* profiles/graphic_drivers: Add open nvidia modules profiles

* profiles/graphics_drivers: closed -> open
  • Loading branch information
ventureoo authored Aug 9, 2024
1 parent 1fd9a65 commit 0d3ef56
Showing 1 changed file with 76 additions and 12 deletions.
88 changes: 76 additions & 12 deletions profiles/pci/graphic_drivers/profiles.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,89 @@
# Or set of devices depending on the generation:
# device_name_pattern = '(AD)\w+'

[nvidia-dkms.40xxcards]
desc = 'Closed source NVIDIA drivers(40xx series) for Linux (Latest)'
priority = 9
device_name_pattern = '(AD)\w+'
[nvidia-open-dkms]
desc = 'Open source NVIDIA drivers for Linux (Latest)'
nonfree = true
class_ids = "0300 0302 0380"
vendor_ids = "10de"
priority = 10
packages = 'nvidia-utils egl-wayland nvidia-settings opencl-nvidia lib32-opencl-nvidia lib32-nvidia-utils libva-nvidia-driver vulkan-icd-loader lib32-vulkan-icd-loader'
conditional_packages = """
kernels="$(pacman -Qqs "^linux-cachyos")"
modules=""
for kernel in $kernels; do
case "$kernel" in
*-nvidia-open) modules+=" ${kernel}";;
*-headers|*-zfs|*-nvidia|*-dbg);;
*) modules+=" ${kernel}-nvidia-open";;
esac
done
# Fallback if there are no kernels with pre-built modules
[ -z "$modules" ] && modules="nvidia-open-dkms"
echo "$modules"
"""
post_install = """
cat <<EOF >/etc/mkinitcpio.conf.d/10-chwd.conf
# This file is automatically generated by chwd. PLEASE DO NOT EDIT IT.
MODULES+=(nvidia nvidia_modeset nvidia_uvm nvidia_drm)
EOF
mkinitcpio -P
# Add libva-nvidia-driver to profile
echo "export LIBVA_DRIVER_NAME=nvidia" > /etc/profile.d/nvidia-vaapi.sh
"""
post_remove = """
rm -f /etc/mkinitcpio.conf.d/10-chwd.conf
rm -f /etc/profile.d/nvidia-vaapi.sh
mkinitcpio -P
"""
device_name_pattern = "([A-Z]+[0-9]+[^M]*)[[:blank:]].*"

[nvidia-open-dkms.prime]
desc = 'Open source NVIDIA drivers for Linux (Latest)'
class_ids = "0300 0302 0380"
device_name_pattern = "([A-Z]+[0-9]+[A-Z]*M)[[:blank:]].*"
priority = 11
packages = 'nvidia-utils egl-wayland nvidia-settings opencl-nvidia lib32-opencl-nvidia lib32-nvidia-utils libva-nvidia-driver vulkan-icd-loader lib32-vulkan-icd-loader nvidia-prime switcheroo-control'
post_install = """
cat <<EOF >/etc/mkinitcpio.conf.d/10-chwd.conf
# This file is automatically generated by chwd. PLEASE DO NOT EDIT IT.
MODULES+=(nvidia nvidia_modeset nvidia_uvm nvidia_drm)
EOF
mkinitcpio -P
systemctl enable switcheroo-control
# Workaround to fix broken RTD3 on GNOME, which keeps taking up 1MB of VRAM
# without letting the dGPU fully sleep or keeping it running for long
# periods of time.
# See: https://gitlab.gnome.org/GNOME/mutter/-/issues/2969
echo "export __EGL_VENDOR_LIBRARY_FILENAMES=/usr/share/glvnd/egl_vendor.d/50_mesa.json" > /etc/profile.d/nvidia-rt3d-workaround.sh
"""
post_remove = """
rm -f /etc/mkinitcpio.conf.d/10-chwd.conf
rm -f /etc/profile.d/nvidia-rt3d-workaround.sh
mkinitcpio -P
"""


[nvidia-dkms]
desc = 'Closed source NVIDIA drivers for Linux (Latest)'
nonfree = true
class_ids = "0300 0302 0380"
vendor_ids = "10de"
priority = 8
priority = 12
packages = 'nvidia-utils egl-wayland nvidia-settings opencl-nvidia lib32-opencl-nvidia lib32-nvidia-utils libva-nvidia-driver vulkan-icd-loader lib32-vulkan-icd-loader'
conditional_packages = """
kernels="$(pacman -Qqs "^linux-cachyos")"
modules=""
for kernel in $kernels; do
case "$kernel" in
*-headers|*-zfs);;
*-headers|*-zfs|*-nvidia-open|*-dbg);;
*-nvidia) modules+=" ${kernel}";;
*) modules+=" ${kernel}-nvidia";;
esac
Expand All @@ -61,13 +125,13 @@ post_remove = """
rm -f /etc/profile.d/nvidia-vaapi.sh
mkinitcpio -P
"""
device_name_pattern = "([A-Z]+[0-9]+[^M]*)[[:blank:]].*"
device_name_pattern = "(GM|GP[0-9]+[^M]*)[[:blank:]].*"

[nvidia-dkms.prime]
desc = 'Closed source NVIDIA drivers for Linux (Latest)'
class_ids = "0300 0302 0380"
device_name_pattern = "([A-Z]+[0-9]+[A-Z]*M)[[:blank:]].*"
priority = 10
device_name_pattern = "(GM|GP[0-9]+[A-Z]*M)[[:blank:]].*"
priority = 13
packages = 'nvidia-utils egl-wayland nvidia-settings opencl-nvidia lib32-opencl-nvidia lib32-nvidia-utils libva-nvidia-driver vulkan-icd-loader lib32-vulkan-icd-loader nvidia-prime switcheroo-control'
post_install = """
cat <<EOF >/etc/mkinitcpio.conf.d/10-chwd.conf
Expand All @@ -91,7 +155,7 @@ post_remove = """

[nvidia-dkms-470xx]
desc = 'Closed source NVIDIA drivers for Linux (470xx branch, only for Kepler GPUs)'
priority = 8
priority = 14
nonfree = true
class_ids = "0300 0380"
vendor_ids = "10de"
Expand All @@ -107,7 +171,7 @@ post_remove = """

[nvidia-dkms-470xx.prime]
desc = 'Closed source NVIDIA drivers for Linux (470xx branch, only for Kepler GPUs)'
priority = 9
priority = 15
class_ids = "0302"
packages = 'nvidia-470xx-dkms nvidia-470xx-utils nvidia-470xx-settings opencl-nvidia-470xx vulkan-icd-loader lib32-nvidia-470xx-utils lib32-opencl-nvidia-470xx lib32-vulkan-icd-loader libva-nvidia-driver switcheroo-control nvidia-prime'
device_name_pattern = '(GK)\w+'
Expand All @@ -117,7 +181,7 @@ post_install = """

[nvidia-dkms-390xx]
desc = 'Closed source NVIDIA drivers for Linux (390xx branch, only for Fermi GPUs)'
priority = 10
priority = 16
nonfree = true
vendor_ids = "10de"
class_ids = "0300 0302 0380"
Expand Down

0 comments on commit 0d3ef56

Please sign in to comment.