Nvidia: Difference between revisions

imported>Ambrop72
"things like Vulkan, CUDA and OpenCL" work in static mode (just tested all of them), removed from cons
imported>User
Remove dynamic mode, since there is now official nvidia solution (which will be merged and documented later)
Line 30: Line 30:
=== Nvidia PRIME ===
=== Nvidia PRIME ===
Official solution by nvidia.
Official solution by nvidia.
==== dynamic mode ====
Like with Bumblebee, in this mode nvidia card is only turned on by need, other time it stays in power saving mode.
* Pros:
** Has better performance than Bumblebee
** Vulkan, CUDA and OpenCL work, though CUDA needs an additional device creation rule https://github.com/NixOS/nixpkgs/blob/05e375d7103ac51e2da917965c37246c99f1ae4f/nixos/modules/hardware/video/nvidia.nix#L72
** Using a pure wayland setup is supported
* Cons:
** There are still some slight issues noted at the top of script
** Launches new X11 server (and so it's preferable to run the WM/DE alongside the program)
'''1.''' Configure NixOS to allow Intel and Nvidia X.Org drivers coexist together (only needed because NixOS forces LD_LIBRARY_PATH variable propagation), and also to disable nvidia card by default.
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
{
  # disable card with bbswitch by default since we turn it on only on demand!
  hardware.nvidiaOptimus.disable = true;
  # install nvidia drivers in addition to intel one
  hardware.opengl.extraPackages = [ pkgs.linuxPackages.nvidia_x11.out ];
  hardware.opengl.extraPackages32 = [ pkgs.linuxPackages.nvidia_x11.lib32 ];
}
</nowiki>}}
'''2.''' Download [https://github.com/dukzcry/crap/tree/master/primerun primerun script].
Like with Bumblebee, start the game via ''primerun.sh''.


==== static mode ====
==== static mode ====
Line 87: Line 59:


* The [https://github.com/guibou/nixGL nixGL project] provides wrapper to use GL drivers outside of NixOS. You need to have nvidia drivers installed on your distro (for kernel modules). Then supply nvidia driver version you use on host system to nixGL.
* The [https://github.com/guibou/nixGL nixGL project] provides wrapper to use GL drivers outside of NixOS. You need to have nvidia drivers installed on your distro (for kernel modules). Then supply nvidia driver version you use on host system to nixGL.
* [https://github.com/dukzcry/crap/tree/master/primerun Optimus only]. Primerun will build nvidia kernel modules against your currently running kernel.


== CUDA ==
== CUDA ==