Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion archinstall/lib/global_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ def _prev_profile(self, item: MenuItem) -> str | None:
output += profile_config.profile.name + '\n'

if profile_config.gfx_driver:
output += tr('Graphics driver') + ': ' + profile_config.gfx_driver.value + '\n'
output += tr('Graphics driver') + ': ' + profile_config.gfx_driver.value[1] + '\n'

if profile_config.greeter:
output += tr('Greeter') + ': ' + profile_config.greeter.value + '\n'
Expand Down
52 changes: 26 additions & 26 deletions archinstall/lib/hardware.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from enum import Enum
from functools import cached_property
from pathlib import Path
from typing import Any

from .exceptions import SysCallError
from .general import SysCommand
Expand Down Expand Up @@ -43,8 +44,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'
Expand All @@ -56,17 +57,23 @@ class GfxPackage(Enum):


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+)'
NvidiaOpenSource = 'Nvidia (open-source nouveau driver)'
NvidiaProprietary = 'Nvidia (proprietary)'
VMOpenSource = 'VirtualBox (open-source)'

def is_nvidia(self) -> bool:
MesaAll = ('mesa_all', 'All open-source')
MesaAmd = ('mesa_amd', 'AMD / ATI (open-source)')
MesaIntel = ('mesa_intel', 'Intel (open-source)')
Nvidia = ('nvidia', 'Nvidia (official open kernel module, for newer GPUs, Turing+)')
MesaNvidia = ('mesa_nvidia', 'Nvidia (open-source nouveau driver)')
MesaVirtualized = ('mesa_vm', 'VirtualBox (open-source)')

@classmethod
def from_key(cls, key: str) -> Any:
for member in cls:
if member.value[0] == key:
return member
return None

def has_dkms_variant(self) -> bool:
match self:
case GfxDriver.NvidiaProprietary | GfxDriver.NvidiaOpenSource | GfxDriver.NvidiaOpenKernel:
case GfxDriver.Nvidia:
return True
case _:
return False
Expand All @@ -84,7 +91,7 @@ def gfx_packages(self) -> list[GfxPackage]:
packages = [GfxPackage.XorgServer, GfxPackage.XorgXinit]

match self:
case GfxDriver.AllOpenSource:
case GfxDriver.MesaAll:
packages += [
GfxPackage.Mesa,
GfxPackage.Xf86VideoAmdgpu,
Expand All @@ -97,41 +104,34 @@ def gfx_packages(self) -> list[GfxPackage]:
GfxPackage.VulkanIntel,
GfxPackage.VulkanNouveau,
]
case GfxDriver.AmdOpenSource:
case GfxDriver.MesaAmd:
packages += [
GfxPackage.Mesa,
GfxPackage.Xf86VideoAmdgpu,
GfxPackage.Xf86VideoAti,
GfxPackage.LibvaMesaDriver,
GfxPackage.VulkanRadeon,
]
case GfxDriver.IntelOpenSource:
case GfxDriver.MesaIntel:
packages += [
GfxPackage.Mesa,
GfxPackage.LibvaIntelDriver,
GfxPackage.IntelMediaDriver,
GfxPackage.VulkanIntel,
]
case GfxDriver.NvidiaOpenKernel:
case GfxDriver.Nvidia:
packages += [
GfxPackage.NvidiaOpenDkms,
GfxPackage.Dkms,
GfxPackage.Nvidia,
GfxPackage.LibvaNvidiaDriver,
]
case GfxDriver.NvidiaOpenSource:
case GfxDriver.MesaNvidia:
packages += [
GfxPackage.Mesa,
GfxPackage.Xf86VideoNouveau,
GfxPackage.LibvaMesaDriver,
GfxPackage.VulkanNouveau,
]
case GfxDriver.NvidiaProprietary:
packages += [
GfxPackage.NvidiaDkms,
GfxPackage.Dkms,
GfxPackage.LibvaNvidiaDriver,
]
case GfxDriver.VMOpenSource:
case GfxDriver.MesaVirtualized:
packages += [
GfxPackage.Mesa,
]
Expand Down
6 changes: 3 additions & 3 deletions archinstall/lib/interactions/system_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ def select_driver(options: list[GfxDriver] = [], preset: GfxDriver | None = None
if not options:
options = [driver for driver in GfxDriver]

items = [MenuItem(o.value, value=o, preview_action=lambda x: x.value.packages_text()) for o in options]
items = [MenuItem(o.value[1], value=o, preview_action=lambda x: x.value.packages_text()) for o in options]
group = MenuItemGroup(items, sort_items=True)
group.set_default_by_value(GfxDriver.AllOpenSource)
group.set_default_by_value(GfxDriver.MesaAll)

if preset is not None:
group.set_focus_by_value(preset)
Expand All @@ -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,
Expand Down
24 changes: 22 additions & 2 deletions archinstall/lib/models/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,26 @@ class _ProfileConfigurationSerialization(TypedDict):
greeter: str | None


def _parse_gfx_driver(value: str) -> GfxDriver:
# A really ugly hack to deal with older configs that use values
# instead of keys for their config.
match value:
case 'All open-source':
return GfxDriver.MesaAll
case 'AMD / ATI (open-source)':
return GfxDriver.MesaAmd
case 'Intel (open-source)':
return GfxDriver.MesaIntel
case 'Nvidia (open kernel module for newer GPUs, Turing+)':
return GfxDriver.Nvidia
case 'Nvidia (open-source nouveau driver)' | 'Nvidia (proprietary)':
return GfxDriver.MesaNvidia
case 'VirtualBox (open-source)':
return GfxDriver.MesaVirtualized

return GfxDriver.from_key(value)


@dataclass
class ProfileConfiguration:
profile: Profile | None = None
Expand All @@ -28,7 +48,7 @@ def json(self) -> _ProfileConfigurationSerialization:

return {
'profile': profile_handler.to_json(self.profile),
'gfx_driver': self.gfx_driver.value if self.gfx_driver else None,
'gfx_driver': self.gfx_driver.value[0] if self.gfx_driver else None,
'greeter': self.greeter.value if self.greeter else None,
}

Expand All @@ -42,6 +62,6 @@ def parse_arg(cls, arg: _ProfileConfigurationSerialization) -> 'ProfileConfigura

return ProfileConfiguration(
profile,
GfxDriver(gfx_driver) if gfx_driver else None,
_parse_gfx_driver(gfx_driver) if gfx_driver else None,
GreeterType(greeter) if greeter else None,
)
10 changes: 6 additions & 4 deletions archinstall/lib/profile/profile_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def _select_profile(self, preset: Profile | None) -> Profile | None:
self._item_group.find_by_key('gfx_driver').value = None
else:
self._item_group.find_by_key('gfx_driver').enabled = True
self._item_group.find_by_key('gfx_driver').value = GfxDriver.AllOpenSource
self._item_group.find_by_key('gfx_driver').value = GfxDriver.MesaAll

if not profile.is_greeter_supported():
self._item_group.find_by_key('greeter').enabled = False
Expand All @@ -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()
Expand All @@ -124,7 +126,7 @@ def _select_gfx_driver(self, preset: GfxDriver | None = None) -> GfxDriver | Non

def _prev_gfx(self, item: MenuItem) -> str | None:
if item.value:
driver = item.get_value().value
driver = item.get_value().value[1]
packages = item.get_value().packages_text()
return f'Driver: {driver}\n{packages}'
return None
Expand Down
22 changes: 17 additions & 5 deletions archinstall/lib/profile/profiles_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -222,14 +222,26 @@ def install_greeter(self, install_session: 'Installer', greeter: GreeterType) ->
file.write(filedata)

def install_gfx_driver(self, install_session: 'Installer', driver: GfxDriver) -> None:
debug(f'Installing GFX driver: {driver.value}')
debug(f'Installing GFX driver: {driver.value[1]}')

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[1]}')

if driver in [GfxDriver.NvidiaOpenKernel, GfxDriver.NvidiaProprietary]:
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)

Expand Down
8 changes: 4 additions & 4 deletions archinstall/locales/base.pot
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,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 ""
Expand Down Expand Up @@ -1051,7 +1051,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 ""

Expand Down Expand Up @@ -1488,7 +1488,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?"
Expand Down
2 changes: 1 addition & 1 deletion examples/config-sample.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
"packages": [],
"parallel downloads": 0,
"profile_config": {
"gfx_driver": "All open-source (default)",
"gfx_driver": "mesa_all",
"greeter": "sddm",
"profile": {
"details": [
Expand Down
2 changes: 1 addition & 1 deletion examples/custom-command-sample.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"packages": ["docker", "git", "wget", "zsh"],
"services": ["docker"],
"profile": "gnome",
"gfx_driver": "All open-source (default)",
"gfx_driver": "mesa_all",
"swap": true,
"sys-encoding": "utf-8",
"sys-language": "en_US",
Expand Down
2 changes: 1 addition & 1 deletion tests/data/test_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
],
"parallel_downloads": 66,
"profile_config": {
"gfx_driver": "All open-source",
"gfx_driver": "mesa_all",
"greeter": "lightdm-gtk-greeter",
"profile": {
"custom_settings": {
Expand Down
2 changes: 1 addition & 1 deletion tests/test_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def test_config_file_parsing(
'main': 'Desktop',
}
),
gfx_driver=GfxDriver.AllOpenSource,
gfx_driver=GfxDriver.MesaAll,
greeter=GreeterType.Lightdm,
),
mirror_config=MirrorConfiguration(
Expand Down