Nvidia: Difference between revisions

imported>Vodkabot
Created page with "For Optimus hybrid graphics there are currently two solutions available under NixOS: 1. '''Bumblebee''' Use <syntaxHighlight lang="nix">hardware.bumblebee.enable = true;</sy..."
 
imported>Vodkabot
No edit summary
Line 12: Line 12:
2. '''Nvidia PRIME'''
2. '''Nvidia PRIME'''


Use the [https://github.com/dukzcry/crap/tree/master/primerun special script] for out of box experience.  
Use the [https://github.com/dukzcry/crap/tree/master/primerun special script] for out of box experience.


There are still some rough edges noted on the top of script, but otherwise it works fine for me.  
Configure NixOS to allow Intel and Nvidia X.Org coexist together, and also to disable nvidia card by default. Requires NixOS version with https://github.com/NixOS/nixpkgs/pull/37369 merged
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
let
  # nvidia packages to use
  nvidia = pkgs.linuxPackages.nvidia_x11;
  nvidia32 = pkgs_i686.linuxPackages.nvidia_x11;
in
{
  hardware.nvidiaOptimus.disable = true; # disable card with bbswitch by default
  boot.extraModulePackages = [ nvidia.bin ]; # load kernel modules
  # install these in parallel with intel
  hardware.opengl.extraPackages = [ nvidia.out ];
  hardware.opengl.extraPackages32 = [ nvidia32.out ];
}
</nowiki>}}


Similar to Bumblebee, start the game via "primerun.sh".  
Similar to Bumblebee, start the game via "primerun.sh".  


Vulkan is supported.
Pros: better performance, Vulkan and Wayland-only setups are supported. CUDA and OpenCL should work, though CUDA needs additional device creation rule https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/hardware/video/nvidia.nix#L66
 
Cons: there are still some rough edges noted on the top of script, but otherwise it works fine for me.