After looking for a way to make Nvidia my primary GPU on Wayland I wanted to share my findings in this thread so that I as well as other people can find the solution to this problem again in future
( Note this will only work if Nvidia drivers is already installed )
If you’re using Fedora with an NVIDIA Optimus setup and want to enable NVIDIA GPU usage for both OpenGL and Vulkan applications on Wayland, you can follow these steps:
Open a Terminal.
Create the configuration file: Run the following command to create and open the necessary file in the text editor nano. (Feel free to replace nano with any editor you prefer.)
bash
mkdir -p ~/.config/environment.d
nano ~/.config/environment.d/90-nvidia.conf
Add the configuration settings: Paste the following lines into the file to set the necessary environment variables for NVIDIA GPU offloading:
bash
__NV_PRIME_RENDER_OFFLOAD=1
__GLX_VENDOR_LIBRARY_NAME=nvidia
__VK_LAYER_NV_optimus=NVIDIA_only
Save and exit the file:
In nano, you can save and exit by pressing Ctrl + X, then Y to confirm, and Enter to save.
Reboot your system to apply the changes:
bash
reboot
After rebooting, your system should use the NVIDIA GPU by default for both OpenGL and Vulkan applications.