NVIDIA: Difference between revisions

From NixOS Wiki
imported>Vodkabot
No edit summary
imported>Vodkabot
No edit summary
Line 1: Line 1:
== Card type ==
== Card type ==


* MXM / output-providing card (shows as VGA Controller in lspci), i.e. graphics card in desktop computer or in high-end laptop
* MXM / output-providing card (shows as ''VGA Controller'' in ''lspci''), i.e. graphics card in desktop computer or in high-end laptop
* muxless/non-MXM Optimus cards have no display outputs and show as 3D Controller in lspci output, seen in most consumer laptops with nvidia hybrid graphics
* muxless/non-MXM Optimus cards have no display outputs and show as ''3D Controller'' in ''lspci'' output, seen in most consumer laptops with nvidia hybrid graphics


== MXM ==
== MXM ==
Line 8: Line 8:
Follow [https://nixos.org/nixos/manual/#idm140737316313424 NVIDIA Graphics Cards] section in official manual.  
Follow [https://nixos.org/nixos/manual/#idm140737316313424 NVIDIA Graphics Cards] section in official manual.  


In case of laptop you may also need to use BIOS option to select which card to use for internal display or you're even forced to use external video port with some laptops
In case of laptop you may also need to use BIOS option to select which card to use for internal display or you're even forced to use external video port with some laptops.


== Optimus ==
== Optimus ==
Line 25: Line 25:
=== Nvidia PRIME ===
=== Nvidia PRIME ===


Use [https://github.com/dukzcry/crap/tree/master/primerun primerun script] for out of box experience.
'''1.''' Configure NixOS to allow Intel and Nvidia X.Org drivers coexist together, and also to disable nvidia card by default. Requires NixOS version with https://github.com/NixOS/nixpkgs/pull/37369 merged
 
Configure NixOS to allow Intel and Nvidia X.Org drivers 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>
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
let
let
Line 44: Line 42:
}
}
</nowiki>}}
</nowiki>}}
'''2.''' Use [https://github.com/dukzcry/crap/tree/master/primerun primerun script] for out of box experience.


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

Revision as of 17:11, 26 April 2018

Card type

  • MXM / output-providing card (shows as VGA Controller in lspci), i.e. graphics card in desktop computer or in high-end laptop
  • muxless/non-MXM Optimus cards have no display outputs and show as 3D Controller in lspci output, seen in most consumer laptops with nvidia hybrid graphics

MXM

Follow NVIDIA Graphics Cards section in official manual.

In case of laptop you may also need to use BIOS option to select which card to use for internal display or you're even forced to use external video port with some laptops.

Optimus

There are currently two solutions available under NixOS:

Bumblebee

Use

hardware.bumblebee.enable = true;

option.


  • Pros: out of box experience, just start the game via primusrun or optirun wrapper
  • Cons: some performance penalty, no Vulkan support, things like CUDA and OpenCL are problematic to configure

Nvidia PRIME

1. Configure NixOS to allow Intel and Nvidia X.Org drivers coexist together, and also to disable nvidia card by default. Requires NixOS version with https://github.com/NixOS/nixpkgs/pull/37369 merged

/etc/nixos/configuration.nix
let
  # nvidia packages to use
  nvidia = pkgs.linuxPackages.nvidia_x11;
  nvidia32 = pkgs_i686.linuxPackages.nvidia_x11;
in
{
  # disable card with bbswitch by default
  hardware.nvidiaOptimus.disable = true;
  # load kernel modules
  boot.extraModulePackages = [ nvidia.bin ];
  # install nvidia drivers in addition to intel one
  hardware.opengl.extraPackages = [ nvidia.out ];
  hardware.opengl.extraPackages32 = [ nvidia32.out ];
}

2. Use primerun script for out of box experience.

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

  • Cons: there are still some rough edges noted on the top of script, but otherwise it works fine for me.