All Projects → deepfire → nix-install-vendor-gl

deepfire / nix-install-vendor-gl

Licence: other
Ensure that a system-compatible OpenGL driver is available for `nix-shell`-encapsulated programs.

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to nix-install-vendor-gl

darknet
Darknet on OpenCL Convolutional Neural Networks on OpenCL on Intel & NVidia & AMD & Mali GPUs for macOS & GNU/Linux
Stars: ✭ 160 (+627.27%)
Mutual labels:  amd, intel, nvidia
Shadowreplay Linux
Shadowplay's Replay Feature On Linux For Nvidia, AMD and Intel
Stars: ✭ 79 (+259.09%)
Mutual labels:  amd, intel, nvidia
Autodesk-Fusion-360-for-Linux
This is a project, where I give you a way to use Autodesk Fusion 360 on Linux!
Stars: ✭ 810 (+3581.82%)
Mutual labels:  amd, intel, nvidia
Inventory Hunter
⚡️ Get notified as soon as your next CPU, GPU, or game console is in stock
Stars: ✭ 778 (+3436.36%)
Mutual labels:  amd, intel, nvidia
Parenchyma
An extensible HPC framework for CUDA, OpenCL and native CPU.
Stars: ✭ 71 (+222.73%)
Mutual labels:  amd, intel, nvidia
Staxrip
StaxRip is a video encoding app for Windows with a unrivaled feature set and usability.
Stars: ✭ 629 (+2759.09%)
Mutual labels:  amd, intel, nvidia
Anakin
High performance Cross-platform Inference-engine, you could run Anakin on x86-cpu,arm, nv-gpu, amd-gpu,bitmain and cambricon devices.
Stars: ✭ 488 (+2118.18%)
Mutual labels:  amd, intel, nvidia
Coriander
Build NVIDIA® CUDA™ code for OpenCL™ 1.2 devices
Stars: ✭ 665 (+2922.73%)
Mutual labels:  amd, intel, nvidia
Ilgpu
ILGPU JIT Compiler for high-performance .Net GPU programs
Stars: ✭ 374 (+1600%)
Mutual labels:  amd, intel, nvidia
Realsr Ncnn Vulkan
RealSR super resolution implemented with ncnn library
Stars: ✭ 357 (+1522.73%)
Mutual labels:  amd, intel, nvidia
gpu-passthrough
A GPU passthrough tutorial using libvirt and KVM on GNU/Linux
Stars: ✭ 57 (+159.09%)
Mutual labels:  amd, intel, nvidia
Waifu2x Ncnn Vulkan
waifu2x converter ncnn version, runs fast on intel / amd / nvidia GPU with vulkan
Stars: ✭ 1,258 (+5618.18%)
Mutual labels:  amd, intel, nvidia
Ocl
OpenCL for Rust
Stars: ✭ 453 (+1959.09%)
Mutual labels:  amd, intel, nvidia
Srmd Ncnn Vulkan
SRMD super resolution implemented with ncnn library
Stars: ✭ 186 (+745.45%)
Mutual labels:  amd, intel, nvidia
Purge Wrangler
AMD & NVIDIA eGPUs for all Thunderbolt Macs.
Stars: ✭ 960 (+4263.64%)
Mutual labels:  amd, nvidia
Nbminer
NVIDIA & AMD GPU Miner for ETH, RVN, GRIN, BEAM, CFX, AE, SERO
Stars: ✭ 568 (+2481.82%)
Mutual labels:  amd, nvidia
Pyopencl
OpenCL integration for Python, plus shiny features
Stars: ✭ 790 (+3490.91%)
Mutual labels:  amd, nvidia
Hidden Miner Builder
Hidden miner builder
Stars: ✭ 58 (+163.64%)
Mutual labels:  amd, nvidia
Set Egpu
Display-agnostic acceleration of macOS applications using external GPUs.
Stars: ✭ 429 (+1850%)
Mutual labels:  amd, nvidia
Obs Streamfx
StreamFX is a plugin for OBS Studio which adds many new effects, filters, sources, transitions and encoders - all for free! Be it 3D Transform, Blur, complex Masking, or even custom shaders, you'll find it all here.
Stars: ✭ 1,128 (+5027.27%)
Mutual labels:  amd, nvidia

nix-install-vendor-gl.sh

Ensure that a system-compatible OpenGL driver is available for nix-shell-encapsulated programs.

This is an attempt at automated solution to NixOS/nixpkgs#9415

The home of nix-install-vendor-gl.sh is at: https://github.com/deepfire/nix-install-vendor-gl

Limitations

Currently only nVidia drivers are supported, although the infrastructure is generalised sufficiently so, that adding support for a new driver stack should amount to extending case statements in a number of functions – the list is here: https://github.com/deepfire/nix-install-vendor-gl/blob/master/nix-install-vendor-gl.sh#L7

OS/GPU test matrix

nvidianouveauAMDGPUradeonsiCatalystIntel
SteamOS
Ubuntu 14.04 LTS
Ubuntu 16.04
Ubuntu 16.10#7
Ubuntu 17.04

Quickstart

Prerequisites

  1. Nix, obviously.
  2. Both system and Nix-provided glxinfo’s:
    system one
    likely, is at /usr/bin/glxinfo (if it is elsewhere, you would have to specify its path with --system-glxinfo). This one is installed with distro-specific means: apt-get install mesa-utils, dnf install glx-utils, or similar.
    Nix-provided
    should be at ~/.nix-profile/bin/glxinfo, and can also be similarly specified.

Typical scenario

  1. Enter shell, face failure:
    desktop@steamos:~/src/reflex-glfw$ nix-shell
    
    [nix-shell:~/src/reflex-glfw]$ glxinfo
    name of display: :1
    libGL error: unable to load driver: swrast_dri.so
    libGL error: failed to load driver: swrast
    X Error of failed request:  GLXBadContext
      Major opcode of failed request:  155 (GLX)
      Minor opcode of failed request:  6 (X_GLXIsDirect)
      Serial number of failed request:  54
      Current serial number in output stream:  53
        
  2. Call for rescue (note the . dot) – will require interactive input, due to a sudo invocation (suggestions on how to improve this are welcome!):
    [nix-shell:~/src/reflex-glfw]$ . ../nix-install-vendor-gl/nix-install-vendor-gl.sh
    INFO: The version of the vendor driver in nixpkgs:  375.26
    doesn't match the system vendor driver version:     367.27
    ..so a semi-automated vendor GL package download is required.
    
    downloading ‘http://download.nvidia.com/XFree86/Linux-x86_64/367.27/NVIDIA-Linux-x86_64-367.27.run’... [74251/75142 KiB, 3525.9 KiB/s]
    path is ‘/nix/store/lfp9md7r5ms29wqy99bsayql8sh9fwbw-NVIDIA-Linux-x86_64-367.27.run’
    /nix/store/4mxr3p5cl16fvmfqqj780937b5wrv1gn-opengl-drivers
    Nix-compatible vendor GL driver is now installed at /run/opengl-driver
    
    To make them available to Nix-build applications you can now issue:
    
       export LD_LIBRARY_PATH=/run/opengl-driver/lib
    
    (Doing the export, in case you have sourced the file directly.)
        
  3. Proceed happily:
    [nix-shell:~/src/reflex-glfw]$ glxinfo
    name of display: :1
    display: :1  screen: 0
    direct rendering: Yes
    server glx vendor string: NVIDIA Corporation
    server glx version string: 1.4
    server glx extensions:
        GLX_ARB_context_flush_control, GLX_ARB_create_context,
        
  4. The cases of re-activation are handled transparently:
    [nix-shell:~/src/reflex-glfw]$ . ../nix-install-vendor-gl/nix-install-vendor-gl.sh
    INFO: Nix-available GL seems to be okay (according to glxinfo exit status).
    
    [nix-shell:~/src/reflex-glfw]$ exit
    exit
    desktop@steamos:~/src/reflex-glfw$ nix-shell
    
    [nix-shell:~/src/reflex-glfw]$ . ../nix-install-vendor-gl/nix-install-vendor-gl.sh
    INFO: A global libGL.so.1 already seems to be installed at
    /run/opengl-driver/lib/libGL.so.1, and it appears to be sufficient for
    the Nix 'glxinfo'.
    
      export LD_LIBRARY_PATH=/run/opengl-driver/lib
        

Troubleshooting

Firstly, there’s an examine subcommand that dumps a lot of information, that might prove to be useful in case something goes wrong.

Secondly, still, if anything goes wrong, please:

  1. If the script is obviously failing, repeat the failing invocation with --verbose.
  2. File a bug report at https://github.com/deepfire/nix-install-vendor-gl/issues (with the log attached, if #1).

Why:

When one uses Nix to run Nix-encapsulated OpenGL software on non-NixOS, it’s not unlikely to encounter a similarly-looking error:

[nix-shell:~/src/reflex-glfw]$ dist/build/reflex-glfw-demo/reflex-glfw-demo libGL error: unable to load driver: swrast_dri.so libGL error: failed to load driver: swrast

This happens because nix isolates your program from the system, which implies a purposeful ignorance of your host GL libraries.

However, these particular host GL libraries are essential for your program to be able to talk to your X server.

The issue is well-known:

NixOS/nixpkgs#9415

So, it’s a fairly fundamental conflict, and one solution is to supply a sufficiently matching version of GL libraries (yes, that means your nVidia drivers) using Nix itself.

Thankfully, it’s not impossible – this script attempts to be a proof.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].