prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Nvidia proprietary driver installation
  Hello 
  
  I tried to install my system via this installer but i can't install nvidia proprietary driver with this installer.
  
  I think there is an option "Nvidia (proprietary)" but it still installing open source nvidia driver.
  https://github.com/archlinux/archinstall/blob/0071a069080732047e11309134869f3ab40c642c/archinstall/lib/hardware.py
  
  How can install proprietary drivers ?
  Instead of gfx_driver option adding nvidia package names to packages option like that :
  ```"packages": ["bash-completion","linux-headers","nvidia","nvidia-settings","opencl-nvidia"]```
  
  
  
  My config file :
  
  ```
  {
    "bootloader": "systemd-bootctl",
    "audio": "pulseaudio",
    "filesystem": "ext4",
    "gfx_driver": "Nvidia (proprietary)",
    "harddrive": {
     "path": "/dev/sda"
    },
    "hostname": "pc",
    "kernels": ["linux"],
    "keyboard-language": "trq",
    "mirror-region": {},
    "nic": {
      "NetworkManager": true
    },
    "profile": "kde",
    "ntp": true,
    "packages": ["bash-completion", "linux-headers"],
    "sys-encoding": "utf-8",
    "timezone": "UTC",
    "!root-password": "****",
    "superusers": {
      "kaan": {
        "!password": "****"
        }
    }
  }
  ```
  
  Thank you.
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `profiles/xorg.py`
  Content:
  ```
  1 # A system with "xorg" installed
  2 
  3 import archinstall
  4 
  5 is_top_level_profile = True
  6 
  7 __description__ = 'Installs a minimal system as well as xorg and graphics drivers.'
  8 
  9 __packages__ = [
  10 	'dkms',
  11 	'xorg-server',
  12 	'xorg-xinit',
  13 	'nvidia-dkms',
  14 	*archinstall.lib.hardware.__packages__,
  15 ]
  16 
  17 
  18 def _prep_function(*args, **kwargs):
  19 	"""
  20 	Magic function called by the importing installer
  21 	before continuing any further. It also avoids executing any
  22 	other code in this stage. So it's a safe way to ask the user
  23 	for more input before any other installer steps start.
  24 	"""
  25 
  26 	archinstall.storage["gfx_driver_packages"] = archinstall.select_driver()
  27 
  28 	# TODO: Add language section and/or merge it with the locale selected
  29 	#       earlier in for instance guided.py installer.
  30 
  31 	return True
  32 
  33 
  34 # Ensures that this code only gets executed if executed
  35 # through importlib.util.spec_from_file_location("xorg", "/somewhere/xorg.py")
  36 # or through conventional import xorg
  37 if __name__ == 'xorg':
  38 	try:
  39 		if "nvidia" in archinstall.storage.get("gfx_driver_packages", None):
  40 			if "linux-zen" in archinstall.storage['installation_session'].base_packages or "linux-lts" in archinstall.storage['installation_session'].base_packages:
  41 				for kernel in archinstall.storage['installation_session'].kernels:
  42 					archinstall.storage['installation_session'].add_additional_packages(f"{kernel}-headers") # Fixes https://github.com/archlinux/archinstall/issues/585
  43 				archinstall.storage['installation_session'].add_additional_packages("dkms")  # I've had kernel regen fail if it wasn't installed before nvidia-dkms
  44 				archinstall.storage['installation_session'].add_additional_packages("xorg-server xorg-xinit nvidia-dkms")
  45 			else:
  46 				archinstall.storage['installation_session'].add_additional_packages(f"xorg-server xorg-xinit {' '.join(archinstall.storage.get('gfx_driver_packages', None))}")
  47 		else:
  48 			archinstall.storage['installation_session'].add_additional_packages(f"xorg-server xorg-xinit {' '.join(archinstall.storage.get('gfx_driver_packages', None))}")
  49 	except:
  50 		archinstall.storage['installation_session'].add_additional_packages("xorg-server xorg-xinit")  # Prep didn't run, so there's no driver to install
  51
  ```
  --- 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()
  
  ```
  
golden_diff: diff --git a/profiles/xorg.py b/profiles/xorg.py
  --- a/profiles/xorg.py
  +++ b/profiles/xorg.py
  @@ -1,6 +1,7 @@
   # A system with "xorg" installed
   
   import archinstall
  +import logging
   
   is_top_level_profile = True
   
  @@ -36,15 +37,16 @@
   # or through conventional import xorg
   if __name__ == 'xorg':
   	try:
  -		if "nvidia" in archinstall.storage.get("gfx_driver_packages", None):
  +		if "nvidia" in archinstall.storage.get("gfx_driver_packages", []):
   			if "linux-zen" in archinstall.storage['installation_session'].base_packages or "linux-lts" in archinstall.storage['installation_session'].base_packages:
   				for kernel in archinstall.storage['installation_session'].kernels:
   					archinstall.storage['installation_session'].add_additional_packages(f"{kernel}-headers") # Fixes https://github.com/archlinux/archinstall/issues/585
   				archinstall.storage['installation_session'].add_additional_packages("dkms")  # I've had kernel regen fail if it wasn't installed before nvidia-dkms
   				archinstall.storage['installation_session'].add_additional_packages("xorg-server xorg-xinit nvidia-dkms")
   			else:
  -				archinstall.storage['installation_session'].add_additional_packages(f"xorg-server xorg-xinit {' '.join(archinstall.storage.get('gfx_driver_packages', None))}")
  +				archinstall.storage['installation_session'].add_additional_packages(f"xorg-server xorg-xinit {' '.join(archinstall.storage.get('gfx_driver_packages', []))}")
   		else:
  -			archinstall.storage['installation_session'].add_additional_packages(f"xorg-server xorg-xinit {' '.join(archinstall.storage.get('gfx_driver_packages', None))}")
  -	except:
  +			archinstall.storage['installation_session'].add_additional_packages(f"xorg-server xorg-xinit {' '.join(archinstall.storage.get('gfx_driver_packages', []))}")
  +	except Exception as err:
  +		archinstall.log(f"Could not handle nvidia and linuz-zen specific situations during xorg installation: {err}", level=logging.WARNING, fg="yellow")
   		archinstall.storage['installation_session'].add_additional_packages("xorg-server xorg-xinit")  # Prep didn't run, so there's no driver to install
  
verification_info: {"golden_diff": "diff --git a/profiles/xorg.py b/profiles/xorg.py\n--- a/profiles/xorg.py\n+++ b/profiles/xorg.py\n@@ -1,6 +1,7 @@\n # A system with \"xorg\" installed\n \n import archinstall\n+import logging\n \n is_top_level_profile = True\n \n@@ -36,15 +37,16 @@\n # or through conventional import xorg\n if __name__ == 'xorg':\n \ttry:\n-\t\tif \"nvidia\" in archinstall.storage.get(\"gfx_driver_packages\", None):\n+\t\tif \"nvidia\" in archinstall.storage.get(\"gfx_driver_packages\", []):\n \t\t\tif \"linux-zen\" in archinstall.storage['installation_session'].base_packages or \"linux-lts\" in archinstall.storage['installation_session'].base_packages:\n \t\t\t\tfor kernel in archinstall.storage['installation_session'].kernels:\n \t\t\t\t\tarchinstall.storage['installation_session'].add_additional_packages(f\"{kernel}-headers\") # Fixes https://github.com/archlinux/archinstall/issues/585\n \t\t\t\tarchinstall.storage['installation_session'].add_additional_packages(\"dkms\")  # I've had kernel regen fail if it wasn't installed before nvidia-dkms\n \t\t\t\tarchinstall.storage['installation_session'].add_additional_packages(\"xorg-server xorg-xinit nvidia-dkms\")\n \t\t\telse:\n-\t\t\t\tarchinstall.storage['installation_session'].add_additional_packages(f\"xorg-server xorg-xinit {' '.join(archinstall.storage.get('gfx_driver_packages', None))}\")\n+\t\t\t\tarchinstall.storage['installation_session'].add_additional_packages(f\"xorg-server xorg-xinit {' '.join(archinstall.storage.get('gfx_driver_packages', []))}\")\n \t\telse:\n-\t\t\tarchinstall.storage['installation_session'].add_additional_packages(f\"xorg-server xorg-xinit {' '.join(archinstall.storage.get('gfx_driver_packages', None))}\")\n-\texcept:\n+\t\t\tarchinstall.storage['installation_session'].add_additional_packages(f\"xorg-server xorg-xinit {' '.join(archinstall.storage.get('gfx_driver_packages', []))}\")\n+\texcept Exception as err:\n+\t\tarchinstall.log(f\"Could not handle nvidia and linuz-zen specific situations during xorg installation: {err}\", level=logging.WARNING, fg=\"yellow\")\n \t\tarchinstall.storage['installation_session'].add_additional_packages(\"xorg-server xorg-xinit\")  # Prep didn't run, so there's no driver to install\n", "issue": "Nvidia proprietary driver installation\nHello \r\n\r\nI tried to install my system via this installer but i can't install nvidia proprietary driver with this installer.\r\n\r\nI think there is an option \"Nvidia (proprietary)\" but it still installing open source nvidia driver.\r\nhttps://github.com/archlinux/archinstall/blob/0071a069080732047e11309134869f3ab40c642c/archinstall/lib/hardware.py\r\n\r\nHow can install proprietary drivers ?\r\nInstead of gfx_driver option adding nvidia package names to packages option like that :\r\n```\"packages\": [\"bash-completion\",\"linux-headers\",\"nvidia\",\"nvidia-settings\",\"opencl-nvidia\"]```\r\n\r\n\r\n\r\nMy config file :\r\n\r\n```\r\n{\r\n  \"bootloader\": \"systemd-bootctl\",\r\n  \"audio\": \"pulseaudio\",\r\n  \"filesystem\": \"ext4\",\r\n  \"gfx_driver\": \"Nvidia (proprietary)\",\r\n  \"harddrive\": {\r\n   \"path\": \"/dev/sda\"\r\n  },\r\n  \"hostname\": \"pc\",\r\n  \"kernels\": [\"linux\"],\r\n  \"keyboard-language\": \"trq\",\r\n  \"mirror-region\": {},\r\n  \"nic\": {\r\n    \"NetworkManager\": true\r\n  },\r\n  \"profile\": \"kde\",\r\n  \"ntp\": true,\r\n  \"packages\": [\"bash-completion\", \"linux-headers\"],\r\n  \"sys-encoding\": \"utf-8\",\r\n  \"timezone\": \"UTC\",\r\n  \"!root-password\": \"****\",\r\n  \"superusers\": {\r\n    \"kaan\": {\r\n      \"!password\": \"****\"\r\n      }\r\n  }\r\n}\r\n```\r\n\r\nThank you.\r\n\n", "before_files": [{"content": "# A system with \"xorg\" installed\n\nimport archinstall\n\nis_top_level_profile = True\n\n__description__ = 'Installs a minimal system as well as xorg and graphics drivers.'\n\n__packages__ = [\n\t'dkms',\n\t'xorg-server',\n\t'xorg-xinit',\n\t'nvidia-dkms',\n\t*archinstall.lib.hardware.__packages__,\n]\n\n\ndef _prep_function(*args, **kwargs):\n\t\"\"\"\n\tMagic function called by the importing installer\n\tbefore continuing any further. It also avoids executing any\n\tother code in this stage. So it's a safe way to ask the user\n\tfor more input before any other installer steps start.\n\t\"\"\"\n\n\tarchinstall.storage[\"gfx_driver_packages\"] = archinstall.select_driver()\n\n\t# TODO: Add language section and/or merge it with the locale selected\n\t#       earlier in for instance guided.py installer.\n\n\treturn True\n\n\n# Ensures that this code only gets executed if executed\n# through importlib.util.spec_from_file_location(\"xorg\", \"/somewhere/xorg.py\")\n# or through conventional import xorg\nif __name__ == 'xorg':\n\ttry:\n\t\tif \"nvidia\" in archinstall.storage.get(\"gfx_driver_packages\", None):\n\t\t\tif \"linux-zen\" in archinstall.storage['installation_session'].base_packages or \"linux-lts\" in archinstall.storage['installation_session'].base_packages:\n\t\t\t\tfor kernel in archinstall.storage['installation_session'].kernels:\n\t\t\t\t\tarchinstall.storage['installation_session'].add_additional_packages(f\"{kernel}-headers\") # Fixes https://github.com/archlinux/archinstall/issues/585\n\t\t\t\tarchinstall.storage['installation_session'].add_additional_packages(\"dkms\")  # I've had kernel regen fail if it wasn't installed before nvidia-dkms\n\t\t\t\tarchinstall.storage['installation_session'].add_additional_packages(\"xorg-server xorg-xinit nvidia-dkms\")\n\t\t\telse:\n\t\t\t\tarchinstall.storage['installation_session'].add_additional_packages(f\"xorg-server xorg-xinit {' '.join(archinstall.storage.get('gfx_driver_packages', None))}\")\n\t\telse:\n\t\t\tarchinstall.storage['installation_session'].add_additional_packages(f\"xorg-server xorg-xinit {' '.join(archinstall.storage.get('gfx_driver_packages', None))}\")\n\texcept:\n\t\tarchinstall.storage['installation_session'].add_additional_packages(\"xorg-server xorg-xinit\")  # Prep didn't run, so there's no driver to install\n", "path": "profiles/xorg.py"}], "after_files": [{"content": "# A system with \"xorg\" installed\n\nimport archinstall\nimport logging\n\nis_top_level_profile = True\n\n__description__ = 'Installs a minimal system as well as xorg and graphics drivers.'\n\n__packages__ = [\n\t'dkms',\n\t'xorg-server',\n\t'xorg-xinit',\n\t'nvidia-dkms',\n\t*archinstall.lib.hardware.__packages__,\n]\n\n\ndef _prep_function(*args, **kwargs):\n\t\"\"\"\n\tMagic function called by the importing installer\n\tbefore continuing any further. It also avoids executing any\n\tother code in this stage. So it's a safe way to ask the user\n\tfor more input before any other installer steps start.\n\t\"\"\"\n\n\tarchinstall.storage[\"gfx_driver_packages\"] = archinstall.select_driver()\n\n\t# TODO: Add language section and/or merge it with the locale selected\n\t#       earlier in for instance guided.py installer.\n\n\treturn True\n\n\n# Ensures that this code only gets executed if executed\n# through importlib.util.spec_from_file_location(\"xorg\", \"/somewhere/xorg.py\")\n# or through conventional import xorg\nif __name__ == 'xorg':\n\ttry:\n\t\tif \"nvidia\" in archinstall.storage.get(\"gfx_driver_packages\", []):\n\t\t\tif \"linux-zen\" in archinstall.storage['installation_session'].base_packages or \"linux-lts\" in archinstall.storage['installation_session'].base_packages:\n\t\t\t\tfor kernel in archinstall.storage['installation_session'].kernels:\n\t\t\t\t\tarchinstall.storage['installation_session'].add_additional_packages(f\"{kernel}-headers\") # Fixes https://github.com/archlinux/archinstall/issues/585\n\t\t\t\tarchinstall.storage['installation_session'].add_additional_packages(\"dkms\")  # I've had kernel regen fail if it wasn't installed before nvidia-dkms\n\t\t\t\tarchinstall.storage['installation_session'].add_additional_packages(\"xorg-server xorg-xinit nvidia-dkms\")\n\t\t\telse:\n\t\t\t\tarchinstall.storage['installation_session'].add_additional_packages(f\"xorg-server xorg-xinit {' '.join(archinstall.storage.get('gfx_driver_packages', []))}\")\n\t\telse:\n\t\t\tarchinstall.storage['installation_session'].add_additional_packages(f\"xorg-server xorg-xinit {' '.join(archinstall.storage.get('gfx_driver_packages', []))}\")\n\texcept Exception as err:\n\t\tarchinstall.log(f\"Could not handle nvidia and linuz-zen specific situations during xorg installation: {err}\", level=logging.WARNING, fg=\"yellow\")\n\t\tarchinstall.storage['installation_session'].add_additional_packages(\"xorg-server xorg-xinit\")  # Prep didn't run, so there's no driver to install\n", "path": "profiles/xorg.py"}]}