We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[Solved] broken intramfs, black screen
Broken initramfs after clean install with encryption, kde desktop and propretary nvidia drivers.
1. Loads grub
2. Decrypt drive
3. Loads initramfs
4. Black screen with no output

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `archinstall/lib/hardware.py`
Content:
```
1 import os
2 from enum import Enum
3 from functools import cached_property
4 from pathlib import Path
5 from typing import Optional, Dict, List
6 
7 from .exceptions import SysCallError
8 from .general import SysCommand
9 from .networking import list_interfaces, enrich_iface_types
10 from .output import debug
11 
12 
13 class CpuVendor(Enum):
14 	AuthenticAMD = 'amd'
15 	GenuineIntel = 'intel'
16 	_Unknown = 'unknown'
17 
18 	@classmethod
19 	def get_vendor(cls, name: str) -> 'CpuVendor':
20 		if vendor := getattr(cls, name, None):
21 			return vendor
22 		else:
23 			debug(f"Unknown CPU vendor '{name}' detected.")
24 			return cls._Unknown
25 
26 	def _has_microcode(self) -> bool:
27 		match self:
28 			case CpuVendor.AuthenticAMD | CpuVendor.GenuineIntel:
29 				return True
30 			case _:
31 				return False
32 
33 	def get_ucode(self) -> Optional[Path]:
34 		if self._has_microcode():
35 			return Path(self.value + '-ucode.img')
36 		return None
37 
38 
39 class GfxPackage(Enum):
40 	IntelMediaDriver = 'intel-media-driver'
41 	LibvaIntelDriver = 'libva-intel-driver'
42 	LibvaMesaDriver = 'libva-mesa-driver'
43 	Mesa = "mesa"
44 	Nvidia = 'nvidia'
45 	NvidiaOpen = 'nvidia-open'
46 	VulkanIntel = 'vulkan-intel'
47 	VulkanRadeon = 'vulkan-radeon'
48 	Xf86VideoAmdgpu = "xf86-video-amdgpu"
49 	Xf86VideoAti = "xf86-video-ati"
50 	Xf86VideoNouveau = 'xf86-video-nouveau'
51 	Xf86VideoVmware = 'xf86-video-vmware'
52 
53 
54 class GfxDriver(Enum):
55 	AllOpenSource = 'All open-source'
56 	AmdOpenSource = 'AMD / ATI (open-source)'
57 	IntelOpenSource = 'Intel (open-source)'
58 	NvidiaOpenKernel = 'Nvidia (open kernel module for newer GPUs, Turing+)'
59 	NvidiaOpenSource = 'Nvidia (open-source nouveau driver)'
60 	NvidiaProprietary = 'Nvidia (proprietary)'
61 	VMOpenSource = 'VMware / VirtualBox (open-source)'
62 
63 	def is_nvidia(self) -> bool:
64 		match self:
65 			case GfxDriver.NvidiaProprietary | \
66 				GfxDriver.NvidiaOpenSource | \
67 				GfxDriver.NvidiaOpenKernel:
68 				return True
69 			case _:
70 				return False
71 
72 	def packages(self) -> List[GfxPackage]:
73 		match self:
74 			case GfxDriver.AllOpenSource:
75 				return [
76 					GfxPackage.Mesa,
77 					GfxPackage.Xf86VideoAmdgpu,
78 					GfxPackage.Xf86VideoAti,
79 					GfxPackage.Xf86VideoNouveau,
80 					GfxPackage.Xf86VideoVmware,
81 					GfxPackage.LibvaMesaDriver,
82 					GfxPackage.LibvaIntelDriver,
83 					GfxPackage.IntelMediaDriver,
84 					GfxPackage.VulkanRadeon,
85 					GfxPackage.VulkanIntel
86 				]
87 			case GfxDriver.AmdOpenSource:
88 				return [
89 					GfxPackage.Mesa,
90 					GfxPackage.Xf86VideoAmdgpu,
91 					GfxPackage.Xf86VideoAti,
92 					GfxPackage.LibvaMesaDriver,
93 					GfxPackage.VulkanRadeon
94 				]
95 			case GfxDriver.IntelOpenSource:
96 				return [
97 					GfxPackage.Mesa,
98 					GfxPackage.LibvaIntelDriver,
99 					GfxPackage.IntelMediaDriver,
100 					GfxPackage.VulkanIntel
101 				]
102 			case GfxDriver.NvidiaOpenKernel:
103 				return [GfxPackage.NvidiaOpen]
104 			case GfxDriver.NvidiaOpenSource:
105 				return [
106 					GfxPackage.Mesa,
107 					GfxPackage.Xf86VideoNouveau,
108 					GfxPackage.LibvaMesaDriver
109 				]
110 			case GfxDriver.NvidiaProprietary:
111 				return [GfxPackage.Nvidia]
112 			case GfxDriver.VMOpenSource:
113 				return [
114 					GfxPackage.Mesa,
115 					GfxPackage.Xf86VideoVmware
116 				]
117 
118 
119 class _SysInfo:
120 	def __init__(self):
121 		pass
122 
123 	@cached_property
124 	def cpu_info(self) -> Dict[str, str]:
125 		"""
126 		Returns system cpu information
127 		"""
128 		cpu_info_path = Path("/proc/cpuinfo")
129 		cpu: Dict[str, str] = {}
130 
131 		with cpu_info_path.open() as file:
132 			for line in file:
133 				if line := line.strip():
134 					key, value = line.split(":", maxsplit=1)
135 					cpu[key.strip()] = value.strip()
136 
137 		return cpu
138 
139 	@cached_property
140 	def mem_info(self) -> Dict[str, int]:
141 		"""
142 		Returns system memory information
143 		"""
144 		mem_info_path = Path("/proc/meminfo")
145 		mem_info: Dict[str, int] = {}
146 
147 		with mem_info_path.open() as file:
148 			for line in file:
149 				key, value = line.strip().split(':')
150 				num = value.split()[0]
151 				mem_info[key] = int(num)
152 
153 		return mem_info
154 
155 	def mem_info_by_key(self, key: str) -> int:
156 		return self.mem_info[key]
157 
158 	@cached_property
159 	def loaded_modules(self) -> List[str]:
160 		"""
161 		Returns loaded kernel modules
162 		"""
163 		modules_path = Path('/proc/modules')
164 		modules: List[str] = []
165 
166 		with modules_path.open() as file:
167 			for line in file:
168 				module = line.split(maxsplit=1)[0]
169 				modules.append(module)
170 
171 		return modules
172 
173 
174 _sys_info = _SysInfo()
175 
176 
177 class SysInfo:
178 	@staticmethod
179 	def has_wifi() -> bool:
180 		ifaces = list(list_interfaces().values())
181 		return 'WIRELESS' in enrich_iface_types(ifaces).values()
182 
183 	@staticmethod
184 	def has_uefi() -> bool:
185 		return os.path.isdir('/sys/firmware/efi')
186 
187 	@staticmethod
188 	def _graphics_devices() -> Dict[str, str]:
189 		cards: Dict[str, str] = {}
190 		for line in SysCommand("lspci"):
191 			if b' VGA ' in line or b' 3D ' in line:
192 				_, identifier = line.split(b': ', 1)
193 				cards[identifier.strip().decode('UTF-8')] = str(line)
194 		return cards
195 
196 	@staticmethod
197 	def has_nvidia_graphics() -> bool:
198 		return any('nvidia' in x.lower() for x in SysInfo._graphics_devices())
199 
200 	@staticmethod
201 	def has_amd_graphics() -> bool:
202 		return any('amd' in x.lower() for x in SysInfo._graphics_devices())
203 
204 	@staticmethod
205 	def has_intel_graphics() -> bool:
206 		return any('intel' in x.lower() for x in SysInfo._graphics_devices())
207 
208 	@staticmethod
209 	def cpu_vendor() -> Optional[CpuVendor]:
210 		if vendor := _sys_info.cpu_info.get('vendor_id'):
211 			return CpuVendor.get_vendor(vendor)
212 		return None
213 
214 	@staticmethod
215 	def cpu_model() -> Optional[str]:
216 		return _sys_info.cpu_info.get('model name', None)
217 
218 	@staticmethod
219 	def sys_vendor() -> str:
220 		with open(f"/sys/devices/virtual/dmi/id/sys_vendor") as vendor:
221 			return vendor.read().strip()
222 
223 	@staticmethod
224 	def product_name() -> str:
225 		with open(f"/sys/devices/virtual/dmi/id/product_name") as product:
226 			return product.read().strip()
227 
228 	@staticmethod
229 	def mem_available() -> int:
230 		return _sys_info.mem_info_by_key('MemAvailable')
231 
232 	@staticmethod
233 	def mem_free() -> int:
234 		return _sys_info.mem_info_by_key('MemFree')
235 
236 	@staticmethod
237 	def mem_total() -> int:
238 		return _sys_info.mem_info_by_key('MemTotal')
239 
240 	@staticmethod
241 	def virtualization() -> Optional[str]:
242 		try:
243 			return str(SysCommand("systemd-detect-virt")).strip('\r\n')
244 		except SysCallError as err:
245 			debug(f"Could not detect virtual system: {err}")
246 
247 		return None
248 
249 	@staticmethod
250 	def is_vm() -> bool:
251 		try:
252 			result = SysCommand("systemd-detect-virt")
253 			return b"none" not in b"".join(result).lower()
254 		except SysCallError as err:
255 			debug(f"System is not running in a VM: {err}")
256 
257 		return False
258 
259 	@staticmethod
260 	def requires_sof_fw() -> bool:
261 		return 'snd_sof' in _sys_info.loaded_modules
262 
263 	@staticmethod
264 	def requires_alsa_fw() -> bool:
265 		modules = (
266 			'snd_asihpi',
267 			'snd_cs46xx',
268 			'snd_darla20',
269 			'snd_darla24',
270 			'snd_echo3g',
271 			'snd_emu10k1',
272 			'snd_gina20',
273 			'snd_gina24',
274 			'snd_hda_codec_ca0132',
275 			'snd_hdsp',
276 			'snd_indigo',
277 			'snd_indigodj',
278 			'snd_indigodjx',
279 			'snd_indigoio',
280 			'snd_indigoiox',
281 			'snd_layla20',
282 			'snd_layla24',
283 			'snd_mia',
284 			'snd_mixart',
285 			'snd_mona',
286 			'snd_pcxhr',
287 			'snd_vx_lib'
288 		)
289 
290 		for loaded_module in _sys_info.loaded_modules:
291 			if loaded_module in modules:
292 				return True
293 
294 		return False
295
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/archinstall/lib/hardware.py b/archinstall/lib/hardware.py
--- a/archinstall/lib/hardware.py
+++ b/archinstall/lib/hardware.py
@@ -42,6 +42,7 @@
 	LibvaMesaDriver = 'libva-mesa-driver'
 	Mesa = "mesa"
 	Nvidia = 'nvidia'
+	NvidiaDKMS = 'nvidia-dkms'
 	NvidiaOpen = 'nvidia-open'
 	VulkanIntel = 'vulkan-intel'
 	VulkanRadeon = 'vulkan-radeon'
@@ -108,7 +109,10 @@
 					GfxPackage.LibvaMesaDriver
 				]
 			case GfxDriver.NvidiaProprietary:
-				return [GfxPackage.Nvidia]
+				return [
+					GfxPackage.Nvidia,
+					GfxPackage.NvidiaDKMS
+				]
 			case GfxDriver.VMOpenSource:
 				return [
 					GfxPackage.Mesa,

{"golden_diff": "diff --git a/archinstall/lib/hardware.py b/archinstall/lib/hardware.py\n--- a/archinstall/lib/hardware.py\n+++ b/archinstall/lib/hardware.py\n@@ -42,6 +42,7 @@\n \tLibvaMesaDriver = 'libva-mesa-driver'\n \tMesa = \"mesa\"\n \tNvidia = 'nvidia'\n+\tNvidiaDKMS = 'nvidia-dkms'\n \tNvidiaOpen = 'nvidia-open'\n \tVulkanIntel = 'vulkan-intel'\n \tVulkanRadeon = 'vulkan-radeon'\n@@ -108,7 +109,10 @@\n \t\t\t\t\tGfxPackage.LibvaMesaDriver\n \t\t\t\t]\n \t\t\tcase GfxDriver.NvidiaProprietary:\n-\t\t\t\treturn [GfxPackage.Nvidia]\n+\t\t\t\treturn [\n+\t\t\t\t\tGfxPackage.Nvidia,\n+\t\t\t\t\tGfxPackage.NvidiaDKMS\n+\t\t\t\t]\n \t\t\tcase GfxDriver.VMOpenSource:\n \t\t\t\treturn [\n \t\t\t\t\tGfxPackage.Mesa,\n", "issue": "[Solved] broken intramfs, black screen\nBroken initramfs after clean install with encryption, kde desktop and propretary nvidia drivers.\r\n1. Loads grub\r\n2. Decrypt drive\r\n3. Loads initramfs\r\n4. Black screen with no output\n", "before_files": [{"content": "import os\nfrom enum import Enum\nfrom functools import cached_property\nfrom pathlib import Path\nfrom typing import Optional, Dict, List\n\nfrom .exceptions import SysCallError\nfrom .general import SysCommand\nfrom .networking import list_interfaces, enrich_iface_types\nfrom .output import debug\n\n\nclass CpuVendor(Enum):\n\tAuthenticAMD = 'amd'\n\tGenuineIntel = 'intel'\n\t_Unknown = 'unknown'\n\n\t@classmethod\n\tdef get_vendor(cls, name: str) -> 'CpuVendor':\n\t\tif vendor := getattr(cls, name, None):\n\t\t\treturn vendor\n\t\telse:\n\t\t\tdebug(f\"Unknown CPU vendor '{name}' detected.\")\n\t\t\treturn cls._Unknown\n\n\tdef _has_microcode(self) -> bool:\n\t\tmatch self:\n\t\t\tcase CpuVendor.AuthenticAMD | CpuVendor.GenuineIntel:\n\t\t\t\treturn True\n\t\t\tcase _:\n\t\t\t\treturn False\n\n\tdef get_ucode(self) -> Optional[Path]:\n\t\tif self._has_microcode():\n\t\t\treturn Path(self.value + '-ucode.img')\n\t\treturn None\n\n\nclass GfxPackage(Enum):\n\tIntelMediaDriver = 'intel-media-driver'\n\tLibvaIntelDriver = 'libva-intel-driver'\n\tLibvaMesaDriver = 'libva-mesa-driver'\n\tMesa = \"mesa\"\n\tNvidia = 'nvidia'\n\tNvidiaOpen = 'nvidia-open'\n\tVulkanIntel = 'vulkan-intel'\n\tVulkanRadeon = 'vulkan-radeon'\n\tXf86VideoAmdgpu = \"xf86-video-amdgpu\"\n\tXf86VideoAti = \"xf86-video-ati\"\n\tXf86VideoNouveau = 'xf86-video-nouveau'\n\tXf86VideoVmware = 'xf86-video-vmware'\n\n\nclass GfxDriver(Enum):\n\tAllOpenSource = 'All open-source'\n\tAmdOpenSource = 'AMD / ATI (open-source)'\n\tIntelOpenSource = 'Intel (open-source)'\n\tNvidiaOpenKernel = 'Nvidia (open kernel module for newer GPUs, Turing+)'\n\tNvidiaOpenSource = 'Nvidia (open-source nouveau driver)'\n\tNvidiaProprietary = 'Nvidia (proprietary)'\n\tVMOpenSource = 'VMware / VirtualBox (open-source)'\n\n\tdef is_nvidia(self) -> bool:\n\t\tmatch self:\n\t\t\tcase GfxDriver.NvidiaProprietary | \\\n\t\t\t\tGfxDriver.NvidiaOpenSource | \\\n\t\t\t\tGfxDriver.NvidiaOpenKernel:\n\t\t\t\treturn True\n\t\t\tcase _:\n\t\t\t\treturn False\n\n\tdef packages(self) -> List[GfxPackage]:\n\t\tmatch self:\n\t\t\tcase GfxDriver.AllOpenSource:\n\t\t\t\treturn [\n\t\t\t\t\tGfxPackage.Mesa,\n\t\t\t\t\tGfxPackage.Xf86VideoAmdgpu,\n\t\t\t\t\tGfxPackage.Xf86VideoAti,\n\t\t\t\t\tGfxPackage.Xf86VideoNouveau,\n\t\t\t\t\tGfxPackage.Xf86VideoVmware,\n\t\t\t\t\tGfxPackage.LibvaMesaDriver,\n\t\t\t\t\tGfxPackage.LibvaIntelDriver,\n\t\t\t\t\tGfxPackage.IntelMediaDriver,\n\t\t\t\t\tGfxPackage.VulkanRadeon,\n\t\t\t\t\tGfxPackage.VulkanIntel\n\t\t\t\t]\n\t\t\tcase GfxDriver.AmdOpenSource:\n\t\t\t\treturn [\n\t\t\t\t\tGfxPackage.Mesa,\n\t\t\t\t\tGfxPackage.Xf86VideoAmdgpu,\n\t\t\t\t\tGfxPackage.Xf86VideoAti,\n\t\t\t\t\tGfxPackage.LibvaMesaDriver,\n\t\t\t\t\tGfxPackage.VulkanRadeon\n\t\t\t\t]\n\t\t\tcase GfxDriver.IntelOpenSource:\n\t\t\t\treturn [\n\t\t\t\t\tGfxPackage.Mesa,\n\t\t\t\t\tGfxPackage.LibvaIntelDriver,\n\t\t\t\t\tGfxPackage.IntelMediaDriver,\n\t\t\t\t\tGfxPackage.VulkanIntel\n\t\t\t\t]\n\t\t\tcase GfxDriver.NvidiaOpenKernel:\n\t\t\t\treturn [GfxPackage.NvidiaOpen]\n\t\t\tcase GfxDriver.NvidiaOpenSource:\n\t\t\t\treturn [\n\t\t\t\t\tGfxPackage.Mesa,\n\t\t\t\t\tGfxPackage.Xf86VideoNouveau,\n\t\t\t\t\tGfxPackage.LibvaMesaDriver\n\t\t\t\t]\n\t\t\tcase GfxDriver.NvidiaProprietary:\n\t\t\t\treturn [GfxPackage.Nvidia]\n\t\t\tcase GfxDriver.VMOpenSource:\n\t\t\t\treturn [\n\t\t\t\t\tGfxPackage.Mesa,\n\t\t\t\t\tGfxPackage.Xf86VideoVmware\n\t\t\t\t]\n\n\nclass _SysInfo:\n\tdef __init__(self):\n\t\tpass\n\n\t@cached_property\n\tdef cpu_info(self) -> Dict[str, str]:\n\t\t\"\"\"\n\t\tReturns system cpu information\n\t\t\"\"\"\n\t\tcpu_info_path = Path(\"/proc/cpuinfo\")\n\t\tcpu: Dict[str, str] = {}\n\n\t\twith cpu_info_path.open() as file:\n\t\t\tfor line in file:\n\t\t\t\tif line := line.strip():\n\t\t\t\t\tkey, value = line.split(\":\", maxsplit=1)\n\t\t\t\t\tcpu[key.strip()] = value.strip()\n\n\t\treturn cpu\n\n\t@cached_property\n\tdef mem_info(self) -> Dict[str, int]:\n\t\t\"\"\"\n\t\tReturns system memory information\n\t\t\"\"\"\n\t\tmem_info_path = Path(\"/proc/meminfo\")\n\t\tmem_info: Dict[str, int] = {}\n\n\t\twith mem_info_path.open() as file:\n\t\t\tfor line in file:\n\t\t\t\tkey, value = line.strip().split(':')\n\t\t\t\tnum = value.split()[0]\n\t\t\t\tmem_info[key] = int(num)\n\n\t\treturn mem_info\n\n\tdef mem_info_by_key(self, key: str) -> int:\n\t\treturn self.mem_info[key]\n\n\t@cached_property\n\tdef loaded_modules(self) -> List[str]:\n\t\t\"\"\"\n\t\tReturns loaded kernel modules\n\t\t\"\"\"\n\t\tmodules_path = Path('/proc/modules')\n\t\tmodules: List[str] = []\n\n\t\twith modules_path.open() as file:\n\t\t\tfor line in file:\n\t\t\t\tmodule = line.split(maxsplit=1)[0]\n\t\t\t\tmodules.append(module)\n\n\t\treturn modules\n\n\n_sys_info = _SysInfo()\n\n\nclass SysInfo:\n\t@staticmethod\n\tdef has_wifi() -> bool:\n\t\tifaces = list(list_interfaces().values())\n\t\treturn 'WIRELESS' in enrich_iface_types(ifaces).values()\n\n\t@staticmethod\n\tdef has_uefi() -> bool:\n\t\treturn os.path.isdir('/sys/firmware/efi')\n\n\t@staticmethod\n\tdef _graphics_devices() -> Dict[str, str]:\n\t\tcards: Dict[str, str] = {}\n\t\tfor line in SysCommand(\"lspci\"):\n\t\t\tif b' VGA ' in line or b' 3D ' in line:\n\t\t\t\t_, identifier = line.split(b': ', 1)\n\t\t\t\tcards[identifier.strip().decode('UTF-8')] = str(line)\n\t\treturn cards\n\n\t@staticmethod\n\tdef has_nvidia_graphics() -> bool:\n\t\treturn any('nvidia' in x.lower() for x in SysInfo._graphics_devices())\n\n\t@staticmethod\n\tdef has_amd_graphics() -> bool:\n\t\treturn any('amd' in x.lower() for x in SysInfo._graphics_devices())\n\n\t@staticmethod\n\tdef has_intel_graphics() -> bool:\n\t\treturn any('intel' in x.lower() for x in SysInfo._graphics_devices())\n\n\t@staticmethod\n\tdef cpu_vendor() -> Optional[CpuVendor]:\n\t\tif vendor := _sys_info.cpu_info.get('vendor_id'):\n\t\t\treturn CpuVendor.get_vendor(vendor)\n\t\treturn None\n\n\t@staticmethod\n\tdef cpu_model() -> Optional[str]:\n\t\treturn _sys_info.cpu_info.get('model name', None)\n\n\t@staticmethod\n\tdef sys_vendor() -> str:\n\t\twith open(f\"/sys/devices/virtual/dmi/id/sys_vendor\") as vendor:\n\t\t\treturn vendor.read().strip()\n\n\t@staticmethod\n\tdef product_name() -> str:\n\t\twith open(f\"/sys/devices/virtual/dmi/id/product_name\") as product:\n\t\t\treturn product.read().strip()\n\n\t@staticmethod\n\tdef mem_available() -> int:\n\t\treturn _sys_info.mem_info_by_key('MemAvailable')\n\n\t@staticmethod\n\tdef mem_free() -> int:\n\t\treturn _sys_info.mem_info_by_key('MemFree')\n\n\t@staticmethod\n\tdef mem_total() -> int:\n\t\treturn _sys_info.mem_info_by_key('MemTotal')\n\n\t@staticmethod\n\tdef virtualization() -> Optional[str]:\n\t\ttry:\n\t\t\treturn str(SysCommand(\"systemd-detect-virt\")).strip('\\r\\n')\n\t\texcept SysCallError as err:\n\t\t\tdebug(f\"Could not detect virtual system: {err}\")\n\n\t\treturn None\n\n\t@staticmethod\n\tdef is_vm() -> bool:\n\t\ttry:\n\t\t\tresult = SysCommand(\"systemd-detect-virt\")\n\t\t\treturn b\"none\" not in b\"\".join(result).lower()\n\t\texcept SysCallError as err:\n\t\t\tdebug(f\"System is not running in a VM: {err}\")\n\n\t\treturn False\n\n\t@staticmethod\n\tdef requires_sof_fw() -> bool:\n\t\treturn 'snd_sof' in _sys_info.loaded_modules\n\n\t@staticmethod\n\tdef requires_alsa_fw() -> bool:\n\t\tmodules = (\n\t\t\t'snd_asihpi',\n\t\t\t'snd_cs46xx',\n\t\t\t'snd_darla20',\n\t\t\t'snd_darla24',\n\t\t\t'snd_echo3g',\n\t\t\t'snd_emu10k1',\n\t\t\t'snd_gina20',\n\t\t\t'snd_gina24',\n\t\t\t'snd_hda_codec_ca0132',\n\t\t\t'snd_hdsp',\n\t\t\t'snd_indigo',\n\t\t\t'snd_indigodj',\n\t\t\t'snd_indigodjx',\n\t\t\t'snd_indigoio',\n\t\t\t'snd_indigoiox',\n\t\t\t'snd_layla20',\n\t\t\t'snd_layla24',\n\t\t\t'snd_mia',\n\t\t\t'snd_mixart',\n\t\t\t'snd_mona',\n\t\t\t'snd_pcxhr',\n\t\t\t'snd_vx_lib'\n\t\t)\n\n\t\tfor loaded_module in _sys_info.loaded_modules:\n\t\t\tif loaded_module in modules:\n\t\t\t\treturn True\n\n\t\treturn False\n", "path": "archinstall/lib/hardware.py"}], "after_files": [{"content": "import os\nfrom enum import Enum\nfrom functools import cached_property\nfrom pathlib import Path\nfrom typing import Optional, Dict, List\n\nfrom .exceptions import SysCallError\nfrom .general import SysCommand\nfrom .networking import list_interfaces, enrich_iface_types\nfrom .output import debug\n\n\nclass CpuVendor(Enum):\n\tAuthenticAMD = 'amd'\n\tGenuineIntel = 'intel'\n\t_Unknown = 'unknown'\n\n\t@classmethod\n\tdef get_vendor(cls, name: str) -> 'CpuVendor':\n\t\tif vendor := getattr(cls, name, None):\n\t\t\treturn vendor\n\t\telse:\n\t\t\tdebug(f\"Unknown CPU vendor '{name}' detected.\")\n\t\t\treturn cls._Unknown\n\n\tdef _has_microcode(self) -> bool:\n\t\tmatch self:\n\t\t\tcase CpuVendor.AuthenticAMD | CpuVendor.GenuineIntel:\n\t\t\t\treturn True\n\t\t\tcase _:\n\t\t\t\treturn False\n\n\tdef get_ucode(self) -> Optional[Path]:\n\t\tif self._has_microcode():\n\t\t\treturn Path(self.value + '-ucode.img')\n\t\treturn None\n\n\nclass GfxPackage(Enum):\n\tIntelMediaDriver = 'intel-media-driver'\n\tLibvaIntelDriver = 'libva-intel-driver'\n\tLibvaMesaDriver = 'libva-mesa-driver'\n\tMesa = \"mesa\"\n\tNvidia = 'nvidia'\n\tNvidiaDKMS = 'nvidia-dkms'\n\tNvidiaOpen = 'nvidia-open'\n\tVulkanIntel = 'vulkan-intel'\n\tVulkanRadeon = 'vulkan-radeon'\n\tXf86VideoAmdgpu = \"xf86-video-amdgpu\"\n\tXf86VideoAti = \"xf86-video-ati\"\n\tXf86VideoNouveau = 'xf86-video-nouveau'\n\tXf86VideoVmware = 'xf86-video-vmware'\n\n\nclass GfxDriver(Enum):\n\tAllOpenSource = 'All open-source'\n\tAmdOpenSource = 'AMD / ATI (open-source)'\n\tIntelOpenSource = 'Intel (open-source)'\n\tNvidiaOpenKernel = 'Nvidia (open kernel module for newer GPUs, Turing+)'\n\tNvidiaOpenSource = 'Nvidia (open-source nouveau driver)'\n\tNvidiaProprietary = 'Nvidia (proprietary)'\n\tVMOpenSource = 'VMware / VirtualBox (open-source)'\n\n\tdef is_nvidia(self) -> bool:\n\t\tmatch self:\n\t\t\tcase GfxDriver.NvidiaProprietary | \\\n\t\t\t\tGfxDriver.NvidiaOpenSource | \\\n\t\t\t\tGfxDriver.NvidiaOpenKernel:\n\t\t\t\treturn True\n\t\t\tcase _:\n\t\t\t\treturn False\n\n\tdef packages(self) -> List[GfxPackage]:\n\t\tmatch self:\n\t\t\tcase GfxDriver.AllOpenSource:\n\t\t\t\treturn [\n\t\t\t\t\tGfxPackage.Mesa,\n\t\t\t\t\tGfxPackage.Xf86VideoAmdgpu,\n\t\t\t\t\tGfxPackage.Xf86VideoAti,\n\t\t\t\t\tGfxPackage.Xf86VideoNouveau,\n\t\t\t\t\tGfxPackage.Xf86VideoVmware,\n\t\t\t\t\tGfxPackage.LibvaMesaDriver,\n\t\t\t\t\tGfxPackage.LibvaIntelDriver,\n\t\t\t\t\tGfxPackage.IntelMediaDriver,\n\t\t\t\t\tGfxPackage.VulkanRadeon,\n\t\t\t\t\tGfxPackage.VulkanIntel\n\t\t\t\t]\n\t\t\tcase GfxDriver.AmdOpenSource:\n\t\t\t\treturn [\n\t\t\t\t\tGfxPackage.Mesa,\n\t\t\t\t\tGfxPackage.Xf86VideoAmdgpu,\n\t\t\t\t\tGfxPackage.Xf86VideoAti,\n\t\t\t\t\tGfxPackage.LibvaMesaDriver,\n\t\t\t\t\tGfxPackage.VulkanRadeon\n\t\t\t\t]\n\t\t\tcase GfxDriver.IntelOpenSource:\n\t\t\t\treturn [\n\t\t\t\t\tGfxPackage.Mesa,\n\t\t\t\t\tGfxPackage.LibvaIntelDriver,\n\t\t\t\t\tGfxPackage.IntelMediaDriver,\n\t\t\t\t\tGfxPackage.VulkanIntel\n\t\t\t\t]\n\t\t\tcase GfxDriver.NvidiaOpenKernel:\n\t\t\t\treturn [GfxPackage.NvidiaOpen]\n\t\t\tcase GfxDriver.NvidiaOpenSource:\n\t\t\t\treturn [\n\t\t\t\t\tGfxPackage.Mesa,\n\t\t\t\t\tGfxPackage.Xf86VideoNouveau,\n\t\t\t\t\tGfxPackage.LibvaMesaDriver\n\t\t\t\t]\n\t\t\tcase GfxDriver.NvidiaProprietary:\n\t\t\t\treturn [\n\t\t\t\t\tGfxPackage.Nvidia,\n\t\t\t\t\tGfxPackage.NvidiaDKMS\n\t\t\t\t]\n\t\t\tcase GfxDriver.VMOpenSource:\n\t\t\t\treturn [\n\t\t\t\t\tGfxPackage.Mesa,\n\t\t\t\t\tGfxPackage.Xf86VideoVmware\n\t\t\t\t]\n\n\nclass _SysInfo:\n\tdef __init__(self):\n\t\tpass\n\n\t@cached_property\n\tdef cpu_info(self) -> Dict[str, str]:\n\t\t\"\"\"\n\t\tReturns system cpu information\n\t\t\"\"\"\n\t\tcpu_info_path = Path(\"/proc/cpuinfo\")\n\t\tcpu: Dict[str, str] = {}\n\n\t\twith cpu_info_path.open() as file:\n\t\t\tfor line in file:\n\t\t\t\tif line := line.strip():\n\t\t\t\t\tkey, value = line.split(\":\", maxsplit=1)\n\t\t\t\t\tcpu[key.strip()] = value.strip()\n\n\t\treturn cpu\n\n\t@cached_property\n\tdef mem_info(self) -> Dict[str, int]:\n\t\t\"\"\"\n\t\tReturns system memory information\n\t\t\"\"\"\n\t\tmem_info_path = Path(\"/proc/meminfo\")\n\t\tmem_info: Dict[str, int] = {}\n\n\t\twith mem_info_path.open() as file:\n\t\t\tfor line in file:\n\t\t\t\tkey, value = line.strip().split(':')\n\t\t\t\tnum = value.split()[0]\n\t\t\t\tmem_info[key] = int(num)\n\n\t\treturn mem_info\n\n\tdef mem_info_by_key(self, key: str) -> int:\n\t\treturn self.mem_info[key]\n\n\t@cached_property\n\tdef loaded_modules(self) -> List[str]:\n\t\t\"\"\"\n\t\tReturns loaded kernel modules\n\t\t\"\"\"\n\t\tmodules_path = Path('/proc/modules')\n\t\tmodules: List[str] = []\n\n\t\twith modules_path.open() as file:\n\t\t\tfor line in file:\n\t\t\t\tmodule = line.split(maxsplit=1)[0]\n\t\t\t\tmodules.append(module)\n\n\t\treturn modules\n\n\n_sys_info = _SysInfo()\n\n\nclass SysInfo:\n\t@staticmethod\n\tdef has_wifi() -> bool:\n\t\tifaces = list(list_interfaces().values())\n\t\treturn 'WIRELESS' in enrich_iface_types(ifaces).values()\n\n\t@staticmethod\n\tdef has_uefi() -> bool:\n\t\treturn os.path.isdir('/sys/firmware/efi')\n\n\t@staticmethod\n\tdef _graphics_devices() -> Dict[str, str]:\n\t\tcards: Dict[str, str] = {}\n\t\tfor line in SysCommand(\"lspci\"):\n\t\t\tif b' VGA ' in line or b' 3D ' in line:\n\t\t\t\t_, identifier = line.split(b': ', 1)\n\t\t\t\tcards[identifier.strip().decode('UTF-8')] = str(line)\n\t\treturn cards\n\n\t@staticmethod\n\tdef has_nvidia_graphics() -> bool:\n\t\treturn any('nvidia' in x.lower() for x in SysInfo._graphics_devices())\n\n\t@staticmethod\n\tdef has_amd_graphics() -> bool:\n\t\treturn any('amd' in x.lower() for x in SysInfo._graphics_devices())\n\n\t@staticmethod\n\tdef has_intel_graphics() -> bool:\n\t\treturn any('intel' in x.lower() for x in SysInfo._graphics_devices())\n\n\t@staticmethod\n\tdef cpu_vendor() -> Optional[CpuVendor]:\n\t\tif vendor := _sys_info.cpu_info.get('vendor_id'):\n\t\t\treturn CpuVendor.get_vendor(vendor)\n\t\treturn None\n\n\t@staticmethod\n\tdef cpu_model() -> Optional[str]:\n\t\treturn _sys_info.cpu_info.get('model name', None)\n\n\t@staticmethod\n\tdef sys_vendor() -> str:\n\t\twith open(f\"/sys/devices/virtual/dmi/id/sys_vendor\") as vendor:\n\t\t\treturn vendor.read().strip()\n\n\t@staticmethod\n\tdef product_name() -> str:\n\t\twith open(f\"/sys/devices/virtual/dmi/id/product_name\") as product:\n\t\t\treturn product.read().strip()\n\n\t@staticmethod\n\tdef mem_available() -> int:\n\t\treturn _sys_info.mem_info_by_key('MemAvailable')\n\n\t@staticmethod\n\tdef mem_free() -> int:\n\t\treturn _sys_info.mem_info_by_key('MemFree')\n\n\t@staticmethod\n\tdef mem_total() -> int:\n\t\treturn _sys_info.mem_info_by_key('MemTotal')\n\n\t@staticmethod\n\tdef virtualization() -> Optional[str]:\n\t\ttry:\n\t\t\treturn str(SysCommand(\"systemd-detect-virt\")).strip('\\r\\n')\n\t\texcept SysCallError as err:\n\t\t\tdebug(f\"Could not detect virtual system: {err}\")\n\n\t\treturn None\n\n\t@staticmethod\n\tdef is_vm() -> bool:\n\t\ttry:\n\t\t\tresult = SysCommand(\"systemd-detect-virt\")\n\t\t\treturn b\"none\" not in b\"\".join(result).lower()\n\t\texcept SysCallError as err:\n\t\t\tdebug(f\"System is not running in a VM: {err}\")\n\n\t\treturn False\n\n\t@staticmethod\n\tdef requires_sof_fw() -> bool:\n\t\treturn 'snd_sof' in _sys_info.loaded_modules\n\n\t@staticmethod\n\tdef requires_alsa_fw() -> bool:\n\t\tmodules = (\n\t\t\t'snd_asihpi',\n\t\t\t'snd_cs46xx',\n\t\t\t'snd_darla20',\n\t\t\t'snd_darla24',\n\t\t\t'snd_echo3g',\n\t\t\t'snd_emu10k1',\n\t\t\t'snd_gina20',\n\t\t\t'snd_gina24',\n\t\t\t'snd_hda_codec_ca0132',\n\t\t\t'snd_hdsp',\n\t\t\t'snd_indigo',\n\t\t\t'snd_indigodj',\n\t\t\t'snd_indigodjx',\n\t\t\t'snd_indigoio',\n\t\t\t'snd_indigoiox',\n\t\t\t'snd_layla20',\n\t\t\t'snd_layla24',\n\t\t\t'snd_mia',\n\t\t\t'snd_mixart',\n\t\t\t'snd_mona',\n\t\t\t'snd_pcxhr',\n\t\t\t'snd_vx_lib'\n\t\t)\n\n\t\tfor loaded_module in _sys_info.loaded_modules:\n\t\t\tif loaded_module in modules:\n\t\t\t\treturn True\n\n\t\treturn False\n", "path": "archinstall/lib/hardware.py"}]}