NVIDIA: Difference between revisions
imported>Clhodapp No edit summary |
imported>Samuela No edit summary |
||
| Line 1: | Line 1: | ||
= | = Installing NVIDIA official drivers = | ||
{{file|/etc/nixos/configuration.nix|nix|<nowiki> | {{file|/etc/nixos/configuration.nix|nix|<nowiki> | ||
{ | { | ||
# NVIDIA drivers are unfree. | |||
nixpkgs.config.allowUnfree = true; | |||
services.xserver.videoDrivers = [ "nvidia" ]; | services.xserver.videoDrivers = [ "nvidia" ]; | ||
hardware.opengl.enable = true; | |||
# Optionally, you may need to select the appropriate driver version for your specific GPU. | |||
hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable; | |||
... | ... | ||
} | |||
</nowiki>}} | </nowiki>}} | ||
As noted in the comment, you'll need to determine the appropriate driver version for your card. For "legacy" cards, you can consult [https://www.nvidia.com/en-us/drivers/unix/legacy-gpu/ nvidia official legacy driver list]. You can consult the set of possible options in the source [https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/os-specific/linux/nvidia-x11/default.nix here]. | |||
= Using your GPU for compute = | |||
NixOS supports using NVIDIA GPUs for pure computing purposes, not just for graphics. For example, many users rely on NixOS for machine learning both locally and on cloud instances. These use cases are supported by the [https://github.com/orgs/NixOS/teams/cuda-maintainers @NixOS/cuda-maintainers team] on GitHub. If you have an issue using your NVIDIA GPU for computing purposes [https://github.com/nixos/nixpkgs/issues/new open an issue] on GitHub and tag @NixOS/cuda-maintainers. | |||
Note that you may need to adjust your driver version to use "data center" GPUs like V100/A100s. See [https://discourse.nixos.org/t/how-to-use-nvidia-v100-a100-gpus/17754 this thread] for more info. | |||
= Using your GPU for graphics = | |||
Please note that, if you are setting up PRIME offloading, you '''must''' set the single value of "nvidia" even though it would be more conceptually correct to also include the driver for your other GPU. Doing otherwise will cause a broken xorg.conf to be generated. This is because NixOS doesn't ''actually'' handle multiple GPUs / GPU drivers properly, as per https://github.com/NixOS/nixpkgs/issues/108018. | Please note that, if you are setting up PRIME offloading, you '''must''' set the single value of "nvidia" even though it would be more conceptually correct to also include the driver for your other GPU. Doing otherwise will cause a broken xorg.conf to be generated. This is because NixOS doesn't ''actually'' handle multiple GPUs / GPU drivers properly, as per https://github.com/NixOS/nixpkgs/issues/108018. | ||