OpenGL: Difference between revisions
imported>Tbenst OpenGL: init with basic info |
imported>Primeos Document how to test Mesa updates (this comes up pretty often) |
||
Line 8: | Line 8: | ||
LD_LIBRARY_PATH="/run/opengl-driver/lib:/run/opengl-driver-32/lib"; | LD_LIBRARY_PATH="/run/opengl-driver/lib:/run/opengl-driver-32/lib"; | ||
== Testing Mesa updates == | |||
To avoid a lot of rebuilds there's an internal NixOS option to override the Mesa drivers: <code>hardware.opengl.package</code> | |||
It can be used like this: <code>hardware.opengl.package = (import /srv/nixpkgs-mesa { }).pkgs.mesa.drivers;</code> | |||
However, since Mesa 21.0.2 this doesn't necessarily work anymore and something like the following might be required: | |||
<pre> | |||
system.replaceRuntimeDependencies = [ | |||
({ original = pkgs.mesa; replacement = (import /srv/nixpkgs-mesa { }).pkgs.mesa; }) | |||
({ original = pkgs.mesa.drivers; replacement = (import /srv/nixpkgs-mesa { }).pkgs.mesa.drivers; }) | |||
]; | |||
</pre> | |||
== Related == | == Related == | ||
https://nixos.wiki/wiki/Nixpkgs_with_OpenGL_on_non-NixOS | https://nixos.wiki/wiki/Nixpkgs_with_OpenGL_on_non-NixOS |
Revision as of 21:04, 24 May 2021
OpenGL must break purity due to the need for hardware-specific linkage. Intel, AMD, and Nvidia will have different libraries for example. On NixOS, these libraries are mounted at
/run/opengl-driver/lib
and
/run/opengl-driver-32/lib
When a program is installed in your environment, these libraries should be found automatically. However, this is not the case in a `nix-shell`. To fix, add this line to your shell.nix:
LD_LIBRARY_PATH="/run/opengl-driver/lib:/run/opengl-driver-32/lib";
Testing Mesa updates
To avoid a lot of rebuilds there's an internal NixOS option to override the Mesa drivers: hardware.opengl.package
It can be used like this: hardware.opengl.package = (import /srv/nixpkgs-mesa { }).pkgs.mesa.drivers;
However, since Mesa 21.0.2 this doesn't necessarily work anymore and something like the following might be required:
system.replaceRuntimeDependencies = [ ({ original = pkgs.mesa; replacement = (import /srv/nixpkgs-mesa { }).pkgs.mesa; }) ({ original = pkgs.mesa.drivers; replacement = (import /srv/nixpkgs-mesa { }).pkgs.mesa.drivers; }) ];