nixGL needs you for testing

I’m the author of nixGL which is a wrapper which installs OpenGL / Vulkan drivers compatible with your nix packages.

What is nixGL ?

This is mandatory to get working OpenGL in two situations:

  • You use nix on a non NixOS system, such as ubuntu or arch linux.
  • Even on nixos, if the nix package you install does not comes from the same nixpkgs clone than your system.

The testing problem

I won’t got in the details and the reasons why this is needed with nix, just keep in mind that OpenGL depends on your hardware configuration, which is by definition not reproducible. Hence it is a pain to test because you need the hardware.

I developed nixGL when I was working in the graphic industry, so I had access to a bunch of hardware configurations and especially, I was working with OpenGL everyday, I had users which were working with OpenGL everyday, so testing changes was easy.

But my life changed, I’m now doing something totally different. I’m now having only a laptop with NixOS and a simple Intel integrated GPU. I’m unable to test on many hardware.

What is currently tested

The current situation is:

  • Mesa (Intel): OpenGL / Vulkan: I can test easily on my current working laptop.
  • Nvidia Hybrid GPU: I can test OpenGL, but not vulkan, and it is a pain because it is on an old laptop which should have died 2 years ago but survives.

Everything else is not tested. I mean, I have no idea about the support for Mesa drivers other than Intel. I don’t know how Nvidia cards are working. I don’t know about the vulkan support for all of that either.

I know that it does not work with proprietary ATI cards. There is a pull request opened since 2 years with an attempt, but I had never found anyone to test it.

Recent nixGL changes

This week-end I’ve done a lot of changes to nixGL:

  • It is now far easier to install and integrate in your own project:
      nixGL = pkgs.callPackage "${builtins.fetchTarball {
        url = https://github.com/guibou/nixGL/archive/17c1ec63b969472555514533569004e5f31a921f.tar.gz;
        sha256 = "0yh8zq746djazjvlspgyy1hvppaynbqrdqpgk447iygkpkp3f5qr";
      }}/nixGL.nix" {};
  • I have added small tests in the CI. At least it tries to build all the supported wrappers and check that they are not making references to non existing files.
  • I have set up a test bench that you can run on your machine. It tests Mesa, Nvidia, Nvidia Hybrid for OpenGL and Vulkan 32 and 64bits. However tests won’t only work if you have the associated hardware. It even allows testing on NixOS and will tell you if your NixOS is too compatible for the test to be useless.
  • Installing is now simpler, the workflow have been uniformized between Nvidia and Mesa and the installation process is able to detect your current nvidia driver version automatically in a robust manner. Said otherwise, nixGL is a one command installation now.

All of that is really great, I’m really happy about that. But I’m not sure any of these works on the configuration I have not tested.

I need you!

If you care about OpenGL / Vulkan support, I’d like you to clone nixGL, run the tests (just run ./Tests.hs in the main directory) and return any issue you have related to your config. Install nixGL, run OpenGL application. If anything is not fine for you, please, open a bug rapport. This will give you a “silver” contributor badge!

What I’d really like to do is to build a list of github users able to test different configurations, so I can ping them during pull request for review. You don’t need any knowledge / understanding of the technical details, as long as you know how to git clone the repository and have an OpenGL application you want to run, you can contribute. This is the “gold” contributor badge!

For the platinum, well, I’d love to find a way to test all of that on CI automatically. If you know a service which can provides free testing machines with different OpenGL hardware, this will be awesome. If you have an hardware configuration which is not yet working with nixGL and are motivated to setup me a remote access to this hardware so I can fix the problem, I’ll be delighted!

Thank you!

15 Likes

Given zero replies — maybe also add some explanation on how to quickly get a failure so I can check if nixGL fixes it? I assume 20.03 vs master is not divergent enough, but 19.09 probably is, right?

I’d just like to say that nixGL is awesome, and I use it regularly without issues. Happy to run any tests in the future. I’m pretty sure most of these errors are due to the fact i’m on the proprietary driver?

Failures:

  Test.hs:79:11:
  1) Sanity.OpenGL fails with unwrapped glxinfo64
       expected: Nothing
        but got: Just "OpenGL version string: 4.6.0 NVIDIA 440.82"

  To rerun use: --match "/Sanity/OpenGL/fails with unwrapped glxinfo64/"

  Test.hs:83:11:
  2) Sanity.OpenGL fails with unwrapped glxinfo32
       expected: Nothing
        but got: Just "OpenGL version string: 4.6.0 NVIDIA 440.82"

  To rerun use: --match "/Sanity/OpenGL/fails with unwrapped glxinfo32/"

  Test.hs:86:11:
  3) Sanity.Vulkan fails with unwrapped vulkaninfo64
       did not get expected exception: IOException

  To rerun use: --match "/Sanity/Vulkan/fails with unwrapped vulkaninfo64/"

  Test.hs:89:11:
  4) Sanity.Vulkan fails with unwrapped vulkaninfo32
       did not get expected exception: IOException

  To rerun use: --match "/Sanity/Vulkan/fails with unwrapped vulkaninfo32/"

  Test.hs:37:7:
  5) NixGL.Mesa.OpenGL 32 bits
       "OpenGL version string: 4.6.0 NVIDIA 440.82" does not contain "Mesa"

  To rerun use: --match "/NixGL/Mesa/OpenGL/32 bits/"

  Test.hs:41:7:
  6) NixGL.Mesa.OpenGL 64 bits
       "OpenGL version string: 4.6.0 NVIDIA 440.82" does not contain "Mesa"

  To rerun use: --match "/NixGL/Mesa/OpenGL/64 bits/"

  Test.hs:53:5:
  7) NixGL.Mesa.Vulkan 32 bits
       uncaught exception: IOException of type OtherError
       readCreateProcess: /nix/store/iacsf82sfm050n2ia4izqfx0ri02bdk2-nixVulkanIntel/bin/nixVulkanIntel "/nix/store/v084dhiad8b8lqxiy02ma2025nxmavcd-vulkan-tools-1.1.114.0/bin/vulkaninfo" (exit 255): failed

  To rerun use: --match "/NixGL/Mesa/Vulkan/32 bits/"

  Test.hs:56:5:
  8) NixGL.Mesa.Vulkan 64 bits
       uncaught exception: IOException of type OtherError
       readCreateProcess: /nix/store/iacsf82sfm050n2ia4izqfx0ri02bdk2-nixVulkanIntel/bin/nixVulkanIntel "/nix/store/7rggmjdqc9p7y0y0vp2x4byx59qfmnpw-vulkan-tools-1.1.114.0/bin/vulkaninfo" (exit 255): failed

  To rerun use: --match "/NixGL/Mesa/Vulkan/64 bits/"

  Test.hs:35:5:
  9) NixGL, Nvidia - Bumblebee, OpenGL, 32 bits
       uncaught exception: IOException of type OtherError
       readCreateProcess: /nix/store/9r83yl1qqhq53vh90k1q2fbmsqy4lvaa-nixGLNvidiaBumblebee-440.82/bin/nixGLNvidiaBumblebee "/nix/store/8zgddbbm68a8r82adsd0k3vj8jpjvfpp-glxinfo-8.4.0/bin/glxinfo" "-B" (exit 1): failed

  To rerun use: --match "/NixGL/Nvidia - Bumblebee/OpenGL/32 bits/"

  Test.hs:39:5:
  10) NixGL, Nvidia - Bumblebee, OpenGL, 64 bits
       uncaught exception: IOException of type OtherError
       readCreateProcess: /nix/store/9r83yl1qqhq53vh90k1q2fbmsqy4lvaa-nixGLNvidiaBumblebee-440.82/bin/nixGLNvidiaBumblebee "/nix/store/hxkj72qzhh0a52wcmaf177ydd47cclx1-glxinfo-8.4.0/bin/glxinfo" "-B" (exit 1): failed

  To rerun use: --match "/NixGL/Nvidia - Bumblebee/OpenGL/64 bits/"

Randomized with seed 851057611

Finished in 97.2927 seconds
16 examples, 10 failures, 2 pending

Happy to report issues to github or get pinged (@mjlbach)

Well, There is now a ./Test.hs which runs test on a different nixpkgs commit (19.09), so you can actually test on recent nixos (20.03) or nixos-unstable.

Yes, and no.

As you guessed, the Mesa tests fails because you are using the nvidia driver. That’s perfectly fine. However, the sanity check here are failing, meaning that your OpenGL setup works without nixGL, which means that your may be on nixos with a nixos version too close to the one used by the test.

So actually, we cannot conclude anything from this test.

Blind running of Test.hs:

glslang gets rebuilt — did not check from which channel.

Hmmmm. On my i915+nouveau/modesetting+modesetting/XRandR providers system it fails NixGL, Nvidia - Bumblebee, OpenGL, 32 bits, NixGL.Nvidia.OpenGL 32 bits, NixGL.Nvidia.Vulkan 32 bits and five more pending (it tries to check nvidia driver status… no success)

What is the correct path from here? Is it the case not foreseen so further details are useless? Should I open an issue in nixGL repo? Anything else?

Could you write a summary? I’m a complete newb. I’ve read this whole discussion on github and I’m not any close to understanding the issue unfortunately. Update: I mean, the way nixGL solves this issue.

https://github.com/NixOS/nixpkgs/issues/9415#

Did it succed the Sanity and Mesa tests? You have a nouveau GPU, so it looks perfectly fine :wink:

You can read a post I wrote one year ago: Design discussion about nixGL (OpenGL / Cuda / OpenCL wrapper for nix) - #2 by Mic92

The global idea is still the same. I should definitly move this documentation to nixGL github.

1 Like

I think nope for Sanity as it tries to load new drivers from /run/opengl-driver into a program with old glibc. nixGL→Mesa just prints «32 bits» and «64 bits» in green which I guess means success.

I do not know how much autodetection the test suit tries to do!

PS. DRI_PRIME=1 does not seem to break anything.

Actually, that’s a reversed test, it succeed if running the application fails :wink:

I just saw this thread, I also want to thank for this, it also helped me for various applications already (in particular nixGLNvidia)

But I just ran into problems with running wgpu-rs (wgpu doesn't find Vulkan device on NixOS with nvidia drivers · Issue #332 · gfx-rs/wgpu-rs · GitHub)

The more I’m testing, the more I think it has to do something with missing vulkan libs.

Here is the Failures output on my system (which is a workstation with a single 1080Ti GPU that uses the proprietary nvidia driver):

Failures:

  Test.hs:77:9:
  1) Sanity.OpenGL fails with unwrapped glxinfo64
       uncaught exception: IOException of type OtherError
       readCreateProcess: /nix/store/hxkj72qzhh0a52wcmaf177ydd47cclx1-glxinfo-8.4.0/bin/glxinfo "-B" (exit 127): failed

  To rerun use: --match "/Sanity/OpenGL/fails with unwrapped glxinfo64/"

  Test.hs:81:9:
  2) Sanity.OpenGL fails with unwrapped glxinfo32
       uncaught exception: IOException of type OtherError
       readCreateProcess: /nix/store/8zgddbbm68a8r82adsd0k3vj8jpjvfpp-glxinfo-8.4.0/bin/glxinfo "-B" (exit 127): failed

  To rerun use: --match "/Sanity/OpenGL/fails with unwrapped glxinfo32/"

  Test.hs:86:11:
  3) Sanity.Vulkan fails with unwrapped vulkaninfo64
       did not get expected exception: IOException

  To rerun use: --match "/Sanity/Vulkan/fails with unwrapped vulkaninfo64/"

  Test.hs:89:11:
  4) Sanity.Vulkan fails with unwrapped vulkaninfo32
       did not get expected exception: IOException

  To rerun use: --match "/Sanity/Vulkan/fails with unwrapped vulkaninfo32/"

  Test.hs:35:5:
  5) NixGL.Mesa.OpenGL 32 bits
       uncaught exception: IOException of type OtherError
       readCreateProcess: /nix/store/6l6j79kpv65yfar3w6nsm5jmfsnx72nw-nixGLIntel/bin/nixGLIntel "/nix/store/8zgddbbm68a8r82adsd0k3vj8jpjvfpp-glxinfo-8.4.0/bin/glxinfo" "-B" (exit 127): failed

  To rerun use: --match "/NixGL/Mesa/OpenGL/32 bits/"

  Test.hs:39:5:
  6) NixGL.Mesa.OpenGL 64 bits
       uncaught exception: IOException of type OtherError
       readCreateProcess: /nix/store/6l6j79kpv65yfar3w6nsm5jmfsnx72nw-nixGLIntel/bin/nixGLIntel "/nix/store/hxkj72qzhh0a52wcmaf177ydd47cclx1-glxinfo-8.4.0/bin/glxinfo" "-B" (exit 127): failed

  To rerun use: --match "/NixGL/Mesa/OpenGL/64 bits/"

  Test.hs:53:5:
  7) NixGL.Mesa.Vulkan 32 bits
       uncaught exception: IOException of type OtherError
       readCreateProcess: /nix/store/iacsf82sfm050n2ia4izqfx0ri02bdk2-nixVulkanIntel/bin/nixVulkanIntel "/nix/store/v084dhiad8b8lqxiy02ma2025nxmavcd-vulkan-tools-1.1.114.0/bin/vulkaninfo" (exit 255): failed

  To rerun use: --match "/NixGL/Mesa/Vulkan/32 bits/"

  Test.hs:56:5:
  8) NixGL.Mesa.Vulkan 64 bits
       uncaught exception: IOException of type OtherError
       readCreateProcess: /nix/store/iacsf82sfm050n2ia4izqfx0ri02bdk2-nixVulkanIntel/bin/nixVulkanIntel "/nix/store/7rggmjdqc9p7y0y0vp2x4byx59qfmnpw-vulkan-tools-1.1.114.0/bin/vulkaninfo" (exit 255): failed

  To rerun use: --match "/NixGL/Mesa/Vulkan/64 bits/"

  Test.hs:35:5:
  9) NixGL, Nvidia - Bumblebee, OpenGL, 32 bits
       uncaught exception: IOException of type OtherError
       readCreateProcess: /nix/store/9r83yl1qqhq53vh90k1q2fbmsqy4lvaa-nixGLNvidiaBumblebee-440.82/bin/nixGLNvidiaBumblebee "/nix/store/8zgddbbm68a8r82adsd0k3vj8jpjvfpp-glxinfo-8.4.0/bin/glxinfo" "-B" (exit 1): failed

  To rerun use: --match "/NixGL/Nvidia - Bumblebee/OpenGL/32 bits/"

  Test.hs:39:5:
  10) NixGL, Nvidia - Bumblebee, OpenGL, 64 bits
       uncaught exception: IOException of type OtherError
       readCreateProcess: /nix/store/9r83yl1qqhq53vh90k1q2fbmsqy4lvaa-nixGLNvidiaBumblebee-440.82/bin/nixGLNvidiaBumblebee "/nix/store/hxkj72qzhh0a52wcmaf177ydd47cclx1-glxinfo-8.4.0/bin/glxinfo" "-B" (exit 1): failed

  To rerun use: --match "/NixGL/Nvidia - Bumblebee/OpenGL/64 bits/"

Randomized with seed 1819266500

Finished in 4.9140 seconds
16 examples, 10 failures, 2 pending

Hi,
i happily use nixGL - however most of the tests seem to fail on my system.
Since I did not ran into any problems myself, I can not open a topic,
but maybe the test output is somewhat helpful for you:

Running tests for nixGL
It can take a while, this will build and test all drivers in the background

Sanity
  OpenGL
    fails with unwrapped glxinfo64 FAILED [1]
    fails with unwrapped glxinfo32 FAILED [2]
  Vulkan
    fails with unwrapped vulkaninfo64
    fails with unwrapped vulkaninfo32
NixGL
  Mesa
    OpenGL
      32 bits FAILED [3]
      64 bits FAILED [4]
    Vulkan
      32 bits
      64 bits
  Nvidia - Bumblebee
    OpenGL
      32 bits FAILED [5]
      64 bits FAILED [6]
    Vulkan
      32 bits
        # PENDING: No reason given
      64 bits
        # PENDING: No reason given
  Nvidia
    OpenGL
      32 bits FAILED [7]
      64 bits FAILED [8]
    Vulkan
      32 bits FAILED [9]
      64 bits FAILED [10]

Failures:

  Test.hs:77:9: 
  1) Sanity.OpenGL fails with unwrapped glxinfo64
       uncaught exception: IOException of type OtherError
       readCreateProcess: /nix/store/hxkj72qzhh0a52wcmaf177ydd47cclx1-glxinfo-8.4.0/bin/glxinfo "-B" (exit 127): failed

  To rerun use: --match "/Sanity/OpenGL/fails with unwrapped glxinfo64/"

  Test.hs:81:9: 
  2) Sanity.OpenGL fails with unwrapped glxinfo32
       uncaught exception: IOException of type OtherError
       readCreateProcess: /nix/store/8zgddbbm68a8r82adsd0k3vj8jpjvfpp-glxinfo-8.4.0/bin/glxinfo "-B" (exit 127): failed

  To rerun use: --match "/Sanity/OpenGL/fails with unwrapped glxinfo32/"

  Test.hs:35:5: 
  3) NixGL.Mesa.OpenGL 32 bits
       uncaught exception: IOException of type OtherError
       readCreateProcess: /nix/store/6l6j79kpv65yfar3w6nsm5jmfsnx72nw-nixGLIntel/bin/nixGLIntel "/nix/store/8zgddbbm68a8r82adsd0k3vj8jpjvfpp-glxinfo-8.4.0/bin/glxinfo" "-B" (exit 127): failed

  To rerun use: --match "/NixGL/Mesa/OpenGL/32 bits/"

  Test.hs:39:5: 
  4) NixGL.Mesa.OpenGL 64 bits
       uncaught exception: IOException of type OtherError
       readCreateProcess: /nix/store/6l6j79kpv65yfar3w6nsm5jmfsnx72nw-nixGLIntel/bin/nixGLIntel "/nix/store/hxkj72qzhh0a52wcmaf177ydd47cclx1-glxinfo-8.4.0/bin/glxinfo" "-B" (exit 127): failed

  To rerun use: --match "/NixGL/Mesa/OpenGL/64 bits/"

  Test.hs:35:5: 
  5) NixGL, Nvidia - Bumblebee, OpenGL, 32 bits
       uncaught exception: IOException of type OtherError
       readCreateProcess: /nix/store/9r83yl1qqhq53vh90k1q2fbmsqy4lvaa-nixGLNvidiaBumblebee-440.82/bin/nixGLNvidiaBumblebee "/nix/store/8zgddbbm68a8r82adsd0k3vj8jpjvfpp-glxinfo-8.4.0/bin/glxinfo" "-B" (exit 1): failed

  To rerun use: --match "/NixGL/Nvidia - Bumblebee/OpenGL/32 bits/"

  Test.hs:39:5: 
  6) NixGL, Nvidia - Bumblebee, OpenGL, 64 bits
       uncaught exception: IOException of type OtherError
       readCreateProcess: /nix/store/9r83yl1qqhq53vh90k1q2fbmsqy4lvaa-nixGLNvidiaBumblebee-440.82/bin/nixGLNvidiaBumblebee "/nix/store/hxkj72qzhh0a52wcmaf177ydd47cclx1-glxinfo-8.4.0/bin/glxinfo" "-B" (exit 1): failed

  To rerun use: --match "/NixGL/Nvidia - Bumblebee/OpenGL/64 bits/"

  Test.hs:36:7: 
  7) NixGL.Nvidia.OpenGL 32 bits
       uncaught exception: IOException of type UserError
       user error (Pattern match failure in do expression at Test.hs:36:7-23)

  To rerun use: --match "/NixGL/Nvidia/OpenGL/32 bits/"

  Test.hs:40:7: 
  8) NixGL.Nvidia.OpenGL 64 bits
       uncaught exception: IOException of type UserError
       user error (Pattern match failure in do expression at Test.hs:40:7-23)

  To rerun use: --match "/NixGL/Nvidia/OpenGL/64 bits/"

  Test.hs:53:5: 
  9) NixGL.Nvidia.Vulkan 32 bits
       uncaught exception: IOException of type OtherError
       readCreateProcess: /nix/store/43hksd1xgp0gj8lp16xg5jak77a595dw-nixVulkanNvidia-440.82/bin/nixVulkanNvidia "/nix/store/v084dhiad8b8lqxiy02ma2025nxmavcd-vulkan-tools-1.1.114.0/bin/vulkaninfo" (exit 255): failed

  To rerun use: --match "/NixGL/Nvidia/Vulkan/32 bits/"

  Test.hs:56:5: 
  10) NixGL.Nvidia.Vulkan 64 bits
       uncaught exception: IOException of type OtherError
       readCreateProcess: /nix/store/43hksd1xgp0gj8lp16xg5jak77a595dw-nixVulkanNvidia-440.82/bin/nixVulkanNvidia "/nix/store/7rggmjdqc9p7y0y0vp2x4byx59qfmnpw-vulkan-tools-1.1.114.0/bin/vulkaninfo" (exit 255): failed

  To rerun use: --match "/NixGL/Nvidia/Vulkan/64 bits/"

Randomized with seed 1476929691

Finished in 5.0562 seconds
16 examples, 10 failures, 2 pending

I run nixGL on my Laptop with ArchLinux and Nvidia Card

From the Usage section of the README, I infer that the user needs to be aware of the available hardware and choose the appropriate wrapper explicitly, by hand. So I’m lost as to how this

is to be used to ‘integrate into [my] own project’.

Does this mean that the project can include this in its derivation, so that the user doesn’t have to mess around with cloning repos and polluting the system with stateful nix-env -is, but the user still has to choose the correct wrapper explicitly and use it to invoke executables?

I guess the bullet point refers to this commit https://github.com/guibou/nixGL/commit/ae5bc98bb7b1cbec930fd146e25ae033a440df00 – before that nixGL could only be used as an overlay.

I think it might be useful for companies that have single type of hardware – then, they can just use, for example, nixGL.nixGLIntel. I do that in configuration for my Ubuntu machine.

And the project also contains a hack to detect the running architecture if you use nixGL.nixGLDefault. So that might work as well.