The error message you are encountering, Error: couldn't find RGB GLX visual or fbconfig, typically indicates that there is an issue with the OpenGL or GLX configuration after downgrading your Mesa version. Here are some steps you can take to troubleshoot and resolve this issue:
1. Check for OpenGL Library Versions
After downgrading Mesa, ensure that the correct OpenGL libraries are being used. You can use ldd to check the linked libraries of glxinfo:
ldd $(which glxinfo)
Ensure that the libraries are pointing to the versions provided by your downgraded Mesa package.
2. Clear the GLSL Cache
Sometimes, the cache can cause issues after a downgrade. You can clear the GLSL cache with the following command:
rm -rf ~/.cache/opengl/
3. Check Driver Configuration
Make sure you are using the correct graphics driver for your hardware. If you have switched graphics drivers (e.g., from nvidia to nouveau), ensure that the appropriate driver is set up in your NixOS configuration.
Also, check the following settings in your /etc/nixos/configuration.nix file:
-
For Intel GPUs:
services.xserver.videoDrivers = [ "intel" ];
-
For AMD GPUs:
services.xserver.videoDrivers = [ "amd" ];
-
For NVIDIA GPUs:
services.xserver.videoDrivers = [ "nvidia" ];
4. Rebuild Your NixOS Configuration
After making changes to your configuration.nix, remember to rebuild your NixOS configuration:
sudo nixos-rebuild switch
5. Ensure the Right DRM Setup
For some systems, you might also need to set the hardware.opengl.enable option in your configuration.nix to ensure that OpenGL and related components are properly initialized:
hardware.opengl.enable = true;
6. Reboot Your System
Sometimes, after making changes to graphics libraries or drivers, a reboot is required to ensure everything is loaded correctly.
7. Debugging Further
If the problem persists, check the Xorg log for errors:
cat /var/log/Xorg.0.log | grep EE
This log may provide you with further insight into what might be going wrong during the initialization.
8. Verify with Other OpenGL Applications
Try running other OpenGL applications (like glxgears or another simple OpenGL program) to see if they exhibit similar issues.
9. Use a Fresh Environment
As a last resort, if nothing works, consider creating a fresh Nix shell environment with nix-shell -p mesa to isolate the problem. This may help you identify if the issue is with existing settings or configurations.
By following these steps, you should be able to troubleshoot the issue stemming from the downgrade of Mesa. If problems continue, consider posting on relevant forums with detailed error output for additional help.