diff --git a/archinstall/lib/global_menu.py b/archinstall/lib/global_menu.py index 9f7ec10398..edd66263d0 100644 --- a/archinstall/lib/global_menu.py +++ b/archinstall/lib/global_menu.py @@ -92,6 +92,14 @@ def _get_menu_options(self) -> list[MenuItem]: preview_action=self._prev_bootloader_config, key='bootloader_config', ), + MenuItem( + text=tr('Kernels'), + value=['linux'], + action=select_kernel, + preview_action=self._prev_kernel, + mandatory=True, + key='kernels', + ), MenuItem( text=tr('Hostname'), value='archlinux', @@ -118,14 +126,6 @@ def _get_menu_options(self) -> list[MenuItem]: preview_action=self._prev_applications, key='app_config', ), - MenuItem( - text=tr('Kernels'), - value=['linux'], - action=select_kernel, - preview_action=self._prev_kernel, - mandatory=True, - key='kernels', - ), MenuItem( text=tr('Network configuration'), action=ask_to_configure_network, diff --git a/archinstall/lib/hardware.py b/archinstall/lib/hardware.py index 3e675f32b4..04b08e0318 100644 --- a/archinstall/lib/hardware.py +++ b/archinstall/lib/hardware.py @@ -43,8 +43,8 @@ class GfxPackage(Enum): LibvaMesaDriver = 'libva-mesa-driver' LibvaNvidiaDriver = 'libva-nvidia-driver' Mesa = 'mesa' - NvidiaDkms = 'nvidia-dkms' - NvidiaOpenDkms = 'nvidia-open-dkms' + Nvidia = 'nvidia-open' + NvidiaDkms = 'nvidia-open-dkms' VulkanIntel = 'vulkan-intel' VulkanRadeon = 'vulkan-radeon' VulkanNouveau = 'vulkan-nouveau' @@ -59,14 +59,13 @@ class GfxDriver(Enum): AllOpenSource = 'All open-source' AmdOpenSource = 'AMD / ATI (open-source)' IntelOpenSource = 'Intel (open-source)' - NvidiaOpenKernel = 'Nvidia (open kernel module for newer GPUs, Turing+)' + Nvidia = 'Nvidia (official open kernel module, for newer GPUs, Turing+)' NvidiaOpenSource = 'Nvidia (open-source nouveau driver)' - NvidiaProprietary = 'Nvidia (proprietary)' VMOpenSource = 'VirtualBox (open-source)' - def is_nvidia(self) -> bool: + def has_dkms_variant(self) -> bool: match self: - case GfxDriver.NvidiaProprietary | GfxDriver.NvidiaOpenSource | GfxDriver.NvidiaOpenKernel: + case GfxDriver.Nvidia: return True case _: return False @@ -112,10 +111,9 @@ def gfx_packages(self) -> list[GfxPackage]: GfxPackage.IntelMediaDriver, GfxPackage.VulkanIntel, ] - case GfxDriver.NvidiaOpenKernel: + case GfxDriver.Nvidia: packages += [ - GfxPackage.NvidiaOpenDkms, - GfxPackage.Dkms, + GfxPackage.Nvidia, GfxPackage.LibvaNvidiaDriver, ] case GfxDriver.NvidiaOpenSource: @@ -125,12 +123,6 @@ def gfx_packages(self) -> list[GfxPackage]: GfxPackage.LibvaMesaDriver, GfxPackage.VulkanNouveau, ] - case GfxDriver.NvidiaProprietary: - packages += [ - GfxPackage.NvidiaDkms, - GfxPackage.Dkms, - GfxPackage.LibvaNvidiaDriver, - ] case GfxDriver.VMOpenSource: packages += [ GfxPackage.Mesa, diff --git a/archinstall/lib/interactions/system_conf.py b/archinstall/lib/interactions/system_conf.py index 0c0e54aaee..11cacede2e 100644 --- a/archinstall/lib/interactions/system_conf.py +++ b/archinstall/lib/interactions/system_conf.py @@ -68,7 +68,7 @@ def select_driver(options: list[GfxDriver] = [], preset: GfxDriver | None = None if SysInfo.has_intel_graphics(): header += tr('For the best compatibility with your Intel hardware, you may want to use either the all open-source or Intel options.\n') if SysInfo.has_nvidia_graphics(): - header += tr('For the best compatibility with your Nvidia hardware, you may want to use the Nvidia proprietary driver.\n') + header += tr('For the best compatibility with your NVIDIA hardware, you may want to use the official NVIDIA driver.\n') result = SelectMenu[GfxDriver]( group, diff --git a/archinstall/lib/models/profile.py b/archinstall/lib/models/profile.py index 80cbde7a19..1f8c81319c 100644 --- a/archinstall/lib/models/profile.py +++ b/archinstall/lib/models/profile.py @@ -28,10 +28,40 @@ def json(self) -> _ProfileConfigurationSerialization: return { 'profile': profile_handler.to_json(self.profile), - 'gfx_driver': self.gfx_driver.value if self.gfx_driver else None, - 'greeter': self.greeter.value if self.greeter else None, + 'gfx_driver': self.gfx_driver.name if self.gfx_driver else None, + 'greeter': self.greeter.name if self.greeter else None, } + @staticmethod + def _parse_gfx_driver(value: str) -> GfxDriver: + """Parse graphics driver with backwards compatibility for old configs.""" + # Mapping for deprecated driver values to new enum members + deprecated_map = { + 'Nvidia (proprietary)': GfxDriver.Nvidia, + 'Nvidia (open kernel module for newer GPUs, Turing+)': GfxDriver.Nvidia, + } + + # Try deprecated value mapping first + if value in deprecated_map: + return deprecated_map[value] + + # Try parsing as enum name (new format) + try: + return GfxDriver[value] + except KeyError: + # Fall back to enum value (old format) + return GfxDriver(value) + + @staticmethod + def _parse_greeter(value: str) -> GreeterType: + """Parse greeter with backwards compatibility for old configs.""" + # Try parsing as enum name (new format) + try: + return GreeterType[value] + except KeyError: + # Fall back to enum value (old format) + return GreeterType(value) + @classmethod def parse_arg(cls, arg: _ProfileConfigurationSerialization) -> 'ProfileConfiguration': from ..profile.profiles_handler import profile_handler @@ -42,6 +72,6 @@ def parse_arg(cls, arg: _ProfileConfigurationSerialization) -> 'ProfileConfigura return ProfileConfiguration( profile, - GfxDriver(gfx_driver) if gfx_driver else None, - GreeterType(greeter) if greeter else None, + cls._parse_gfx_driver(gfx_driver) if gfx_driver else None, + cls._parse_greeter(greeter) if greeter else None, ) diff --git a/archinstall/lib/profile/profile_menu.py b/archinstall/lib/profile/profile_menu.py index d434fc2fb3..9033401fab 100644 --- a/archinstall/lib/profile/profile_menu.py +++ b/archinstall/lib/profile/profile_menu.py @@ -100,8 +100,10 @@ def _select_gfx_driver(self, preset: GfxDriver | None = None) -> GfxDriver | Non driver = select_driver(preset=preset) if driver and 'Sway' in profile.current_selection_names(): - if driver.is_nvidia(): - header = tr('The proprietary Nvidia driver is not supported by Sway.') + '\n' + # Sway only cares about the official NVIDIA driver in this situation + # see: https://github.com/swaywm/sway/blob/238f0d4a8b399f0df6791c47eb54c8636722d5a9/sway/server.c#L165 + if driver == GfxDriver.Nvidia: + header = tr('The official NVIDIA driver is not supported by Sway.') + '\n' header += tr('It is likely that you will run into issues, are you okay with that?') + '\n' group = MenuItemGroup.yes_no() diff --git a/archinstall/lib/profile/profiles_handler.py b/archinstall/lib/profile/profiles_handler.py index 96ce476aba..3a979e62d1 100644 --- a/archinstall/lib/profile/profiles_handler.py +++ b/archinstall/lib/profile/profiles_handler.py @@ -13,7 +13,7 @@ from archinstall.lib.translationhandler import tr from ...default_profiles.profile import GreeterType, Profile -from ..hardware import GfxDriver +from ..hardware import GfxDriver, GfxPackage from ..models.profile import ProfileConfiguration from ..networking import fetch_data_from_url, list_interfaces from ..output import debug, error, info @@ -229,12 +229,24 @@ def install_greeter(self, install_session: 'Installer', greeter: GreeterType) -> def install_gfx_driver(self, install_session: 'Installer', driver: GfxDriver) -> None: debug(f'Installing GFX driver: {driver.value}') - if driver in [GfxDriver.NvidiaOpenKernel, GfxDriver.NvidiaProprietary]: + driver_pkgs = driver.gfx_packages() + # All non-standard kernel packages have a '-' in their name. + # ex: 'linux-zen' and 'linux-lts' + is_dkms_needed = any('-' in s for s in install_session.kernels) + + if driver.has_dkms_variant() and is_dkms_needed: + debug(f'A non-standard kernel was selected, installing DKMS variant of {driver.value}') + headers = [f'{kernel}-headers' for kernel in install_session.kernels] - # Fixes https://github.com/archlinux/archinstall/issues/585 install_session.add_additional_packages(headers) - driver_pkgs = driver.gfx_packages() + driver_pkgs.append(GfxPackage.Dkms) + + match driver: + case GfxDriver.Nvidia: + driver_pkgs.remove(GfxPackage.Nvidia) + driver_pkgs.append(GfxPackage.NvidiaDkms) + pkg_names = [p.value for p in driver_pkgs] install_session.add_additional_packages(pkg_names) diff --git a/archinstall/locales/base.pot b/archinstall/locales/base.pot index 4afd74ab7f..142953e892 100644 --- a/archinstall/locales/base.pot +++ b/archinstall/locales/base.pot @@ -196,8 +196,8 @@ msgid "" msgstr "" msgid "" -"For the best compatibility with your Nvidia hardware, you may want to use " -"the Nvidia proprietary driver.\n" +"For the best compatibility with your NVIDIA hardware, you may want to use " +"the official NVIDIA driver.\n" msgstr "" msgid "" @@ -1054,7 +1054,7 @@ msgid "Environment type: {}" msgstr "" msgid "" -"The proprietary Nvidia driver is not supported by Sway. It is likely that " +"The official NVIDIA driver is not supported by Sway. It is likely that " "you will run into issues, are you okay with that?" msgstr "" @@ -1491,7 +1491,7 @@ msgstr "" msgid "Info" msgstr "" -msgid "The proprietary Nvidia driver is not supported by Sway." +msgid "The official NVIDIA driver is not supported by Sway." msgstr "" msgid "It is likely that you will run into issues, are you okay with that?" diff --git a/tests/data/test_config.json b/tests/data/test_config.json index 618bd8e9c7..8cb09421f5 100644 --- a/tests/data/test_config.json +++ b/tests/data/test_config.json @@ -182,8 +182,8 @@ ], "parallel_downloads": 66, "profile_config": { - "gfx_driver": "All open-source", - "greeter": "lightdm-gtk-greeter", + "gfx_driver": "AllOpenSource", + "greeter": "Lightdm", "profile": { "custom_settings": { "Hyprland": {