Run your nix programs with your host graphics drivers.
Go to file
Félix Baylac-Jacqué 0ccc67bbb4
nix-gl-host: first relatively naive implementation
First take.

For now, we're only try to support the Nvidia proprietary driver. We
also cut quite some corners :)

We hardcode a list of DSOs we're looking for in the code. That's
obviously the best long-term decision, we'll have to revise this
particular approach later on.

We're looking for these listed DSOs in the GL_VENDOR_PATH provided by
the user. We'll need to patch these DSOs and we obviously don't want
to alter the host OS configuration. So we have to first copy them to
the user XDG cache directory.

Once copied, we alter their runpath to point to the user cache dir:
these DSO can depend on each other.

Finally, we point the patched libglvnd GLX implementation to the cache
dir and replace the current process with the target one.
2022-11-24 17:03:46 +01:00
README.md Init: add short readme describing the project's goal 2022-11-22 10:28:40 +01:00
default.nix Add Nix build infrastructure 2022-11-24 17:03:42 +01:00
flake.lock Add Nix build infrastructure 2022-11-24 17:03:42 +01:00
flake.nix Add Nix build infrastructure 2022-11-24 17:03:42 +01:00
nixglhost-wrapper.py nix-gl-host: first relatively naive implementation 2022-11-24 17:03:46 +01:00
shell.nix Add Nix build infrastructure 2022-11-24 17:03:42 +01:00

README.md

NixGLHost

Running OpenGL Nix-built binaries on a foreign Linux distro is quite often a challenge. NixGLHost is gluing your nix-built binaries to the host OpenGL implementation.

NixGLHost Approach

TODO before release, rephrase this, explain further. Clone the blog post in this section?

  1. Patched libGLVnd to load vendor DSOs from a custom location, not relying on the library path.
  2. Copy the host vendor DSOs to a nix-tmp location.
  3. Modify the vendor DSOs runpath to point to the place where the vendor libs live.
  4. Wrap the nix-built binary, inject the libGLVnd-specific env variables to point to the patched vendor lib dir.

Support

  • Proprietary Nvidia
    • GLX
    • EGL
    • Cuda
    • OpenCL
  • Mesa
    • GLX
    • EGL
    • OpenCL

Alternative Approaches

  • NixGL: tries to auto detect the host vendor driver, download it again, store it in the nix-store then wraps the nix-built binary and inject the downloaded vendor driver through LD_LIBRARY_PATH.

Authors/Maintainers