NVIDIA: Difference between revisions
Clarify requirements for unfree. See https://github.com/NixOS/nixpkgs/issues/362500 |
Redchess64 (talk | contribs) add note about build failures |
||
(11 intermediate revisions by 8 users not shown) | |||
Line 14: | Line 14: | ||
{ | { | ||
hardware.graphics.enable = true; | hardware.graphics.enable = true; | ||
services.xserver.videoDrivers = [ "nvidia" ]; | services.xserver.videoDrivers = [ "nvidia" ]; | ||
hardware.nvidia.open = true; # | hardware.nvidia.open = true; # see the note above | ||
} | } | ||
</nowiki>}} | </nowiki>}} | ||
Line 85: | Line 84: | ||
{{file|configuration.nix|nix|<nowiki> | {{file|configuration.nix|nix|<nowiki> | ||
{ | { | ||
# For offloading, `modesetting` is needed additionally, | |||
# otherwise the X-server will be running permanently on nvidia, | |||
# thus keeping the GPU always on (see `nvidia-smi`). | |||
services.xserver.videoDrivers = [ | |||
"modesetting" # example for Intel iGPU; use "amdgpu" here instead if your iGPU is AMD | |||
"nvidia" | |||
]; | |||
hardware.nvidia.prime = { | hardware.nvidia.prime = { | ||
offload.enable = true; | offload.enable = true; | ||
Line 121: | Line 128: | ||
{{Note|Reverse sync mode is available '''since NixOS 23.05 and NVIDIA driver version 460.39''' and is still an experimental, buggy feature<ref>https://forums.developer.nvidia.com/t/the-all-new-outputsink-feature-aka-reverse-prime/129828/67</ref>. '''Your mileage may vary.''' Reverse sync mode is '''incompatible''' with sync mode and requires using a desktop manager that respects the <code>services.xserver.displayManager.setupCommands</code> option, including LightDM, GDM and SDDM.}}The difference between regular sync mode and reverse sync mode is that the '''dGPU''' is configured as the primary output device, allowing displaying to external displays wired to it and not the iGPU (more common). | {{Note|Reverse sync mode is available '''since NixOS 23.05 and NVIDIA driver version 460.39''' and is still an experimental, buggy feature<ref>https://forums.developer.nvidia.com/t/the-all-new-outputsink-feature-aka-reverse-prime/129828/67</ref>. '''Your mileage may vary.''' Reverse sync mode is '''incompatible''' with sync mode and requires using a desktop manager that respects the <code>services.xserver.displayManager.setupCommands</code> option, including LightDM, GDM and SDDM.}}The difference between regular sync mode and reverse sync mode is that the '''dGPU''' is configured as the primary output device, allowing displaying to external displays wired to it and not the iGPU (more common). | ||
To enable sync mode, set the <code>hardware.nvidia.prime.reverseSync.enable</code> option to <code>true</code>: | To enable reverse sync mode, set the <code>hardware.nvidia.prime.reverseSync.enable</code> option to <code>true</code>: | ||
{{file|/etc/nixos/configuration.nix|nix|<nowiki> | {{file|/etc/nixos/configuration.nix|nix|<nowiki> | ||
Line 199: | Line 206: | ||
This allows you to pin the specific driver version being used in your NixOS installation. | This allows you to pin the specific driver version being used in your NixOS installation. | ||
You might want to do this if you are running the newest kernel, as the packaged drivers may fail to build otherwise<ref>https://github.com/NixOS/nixpkgs/issues/429624#issuecomment-3189861599</ref>. | |||
== Troubleshooting == | == Troubleshooting == | ||
Line 229: | Line 237: | ||
=== Graphical corruption and system crashes on suspend/resume === | === Graphical corruption and system crashes on suspend/resume === | ||
<code>powerManagement.enable = true</code> can sometimes fix this, but is itself unstable and is known to cause suspend issues. | <code>powerManagement.enable = true</code> can sometimes fix this, but is itself unstable and is known to cause suspend issues. | ||
<code>hardware.nvidia.powerManagement.enable = true</code> can also sometimes fix this issue; it is <code>false</code> by default. | |||
If you have a modern NVIDIA GPU (Turing [https://en.wikipedia.org/wiki/Turing_(microarchitecture)#Products_using_Turing] or later), you may also want to investigate the <code>hardware.nvidia.powerManagement.finegrained</code> option: [https://download.nvidia.com/XFree86/Linux-x86_64/460.73.01/README/dynamicpowermanagement.html] | If you have a modern NVIDIA GPU (Turing [https://en.wikipedia.org/wiki/Turing_(microarchitecture)#Products_using_Turing] or later), you may also want to investigate the <code>hardware.nvidia.powerManagement.finegrained</code> option: [https://download.nvidia.com/XFree86/Linux-x86_64/460.73.01/README/dynamicpowermanagement.html] | ||
Line 258: | Line 268: | ||
=== Nouveau === | === Nouveau === | ||
Nouveau can be disabled by blacklisting the <code>nouveau</code> kernel module:<syntaxhighlight lang="nix"> | Nouveau can be disabled by blacklisting the <code>nouveau</code> kernel module: | ||
Note: This is done by default when using proprietary drivers<syntaxhighlight lang="nix"> | |||
{ | { | ||
boot.blacklistedKernelModules = [ "nouveau" ]; | boot.blacklistedKernelModules = [ "nouveau" ]; | ||
Line 266: | Line 278: | ||
== Footnotes == | == Footnotes == | ||
[[Category:Video]] | [[Category:Video]] | ||
<references />4. https://discourse.nixos.org/t/nvidia-open-breaks-hardware-acceleration/58770/1 |