OpenGL: Difference between revisions

imported>PedroHLC
Open a merge candidate with "Mesa"
imported>Fufexan
Add syntax highlighting
Line 11: Line 11:


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:
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";
<syntaxhighlight lang="nix">LD_LIBRARY_PATH="/run/opengl-driver/lib:/run/opengl-driver-32/lib";</syntaxhighlight>


== Testing Mesa updates ==
== Testing Mesa updates ==
Line 17: Line 17:
To avoid a lot of rebuilds there's an internal NixOS option to override the Mesa drivers: <code>hardware.opengl.package</code>
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>
It can be used like this: <syntaxhighlight lang="nix">hardware.opengl.package = (import /srv/nixpkgs-mesa { }).pkgs.mesa.drivers;</syntaxhighlight>


However, since Mesa 21.0.2 this doesn't necessarily work anymore and something like the following might be required:
However, since Mesa 21.0.2 this doesn't necessarily work anymore and something like the following might be required:
<pre>
<syntaxhighlight lang="nix">
system.replaceRuntimeDependencies = [
system.replaceRuntimeDependencies = [
   ({ original = pkgs.mesa; replacement = (import /srv/nixpkgs-mesa { }).pkgs.mesa; })
   ({ original = pkgs.mesa; replacement = (import /srv/nixpkgs-mesa { }).pkgs.mesa; })
   ({ original = pkgs.mesa.drivers; replacement = (import /srv/nixpkgs-mesa { }).pkgs.mesa.drivers; })
   ({ original = pkgs.mesa.drivers; replacement = (import /srv/nixpkgs-mesa { }).pkgs.mesa.drivers; })
];
];
</pre>
</syntaxhighlight>


'''Note:''' Both of these approaches are impure and only work to a certain degree (many limitations!). If you want to use a different version of Mesa your best option is to use an overlay or a Git worktree where you use the same Nixpkgs revision and only alter <code>pkgs/development/libraries/mesa/</code> for one of the two approaches mentioned above.
'''Note:''' Both of these approaches are impure and only work to a certain degree (many limitations!). If you want to use a different version of Mesa your best option is to use an overlay or a Git worktree where you use the same Nixpkgs revision and only alter <code>pkgs/development/libraries/mesa/</code> for one of the two approaches mentioned above.