Skip to content

Commit a3c6bd5

Browse files
authored
Use nvidia-open instead of nvidia-open-dkms for mainline kernels (#4347)
1 parent 0175949 commit a3c6bd5

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

archinstall/lib/hardware.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class GfxPackage(Enum):
4343
LibvaIntelDriver = 'libva-intel-driver'
4444
LibvaNvidiaDriver = 'libva-nvidia-driver'
4545
Mesa = 'mesa'
46+
NvidiaOpen = 'nvidia-open'
4647
NvidiaOpenDkms = 'nvidia-open-dkms'
4748
VulkanIntel = 'vulkan-intel'
4849
VulkanRadeon = 'vulkan-radeon'

archinstall/lib/profile/profiles_handler.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from typing import TYPE_CHECKING, NotRequired, TypedDict
1111

1212
from archinstall.default_profiles.profile import GreeterType, Profile
13-
from archinstall.lib.hardware import GfxDriver
13+
from archinstall.lib.hardware import GfxDriver, GfxPackage
1414
from archinstall.lib.models.profile import ProfileConfiguration
1515
from archinstall.lib.networking import fetch_data_from_url
1616
from archinstall.lib.output import debug, error, info
@@ -222,13 +222,22 @@ def install_greeter(self, install_session: Installer, greeter: GreeterType) -> N
222222
def install_gfx_driver(self, install_session: Installer, driver: GfxDriver) -> None:
223223
debug(f'Installing GFX driver: {driver.value}')
224224

225-
if driver in [GfxDriver.NvidiaOpenKernel]:
226-
headers = [f'{kernel}-headers' for kernel in install_session.kernels]
227-
# Fixes https://github.com/archlinux/archinstall/issues/585
228-
install_session.add_additional_packages(headers)
229-
230225
driver_pkgs = driver.gfx_packages()
231226
pkg_names = [p.value for p in driver_pkgs]
227+
228+
# For Nvidia open kernel modules, use nvidia-open instead of nvidia-open-dkms
229+
# when all selected kernels are mainline (no dkms needed). This avoids
230+
# installing dkms + kernel headers and speeds up installation.
231+
if driver == GfxDriver.NvidiaOpenKernel:
232+
needs_dkms = any('-' in k for k in install_session.kernels)
233+
234+
if needs_dkms:
235+
headers = [f'{kernel}-headers' for kernel in install_session.kernels]
236+
install_session.add_additional_packages(headers)
237+
else:
238+
pkg_names = [GfxPackage.NvidiaOpen.value if p == GfxPackage.NvidiaOpenDkms.value else p for p in pkg_names]
239+
pkg_names = [p for p in pkg_names if p != GfxPackage.Dkms.value]
240+
232241
install_session.add_additional_packages(pkg_names)
233242

234243
def install_profile_config(self, install_session: Installer, profile_config: ProfileConfiguration) -> None:

0 commit comments

Comments
 (0)