NVIDIA: Difference between revisions

imported>Jmq
m Unfree also required for settings.
imported>Gerg-L
No edit summary
Line 12: Line 12:
   };
   };


  # NVIDIA drivers are unfree.
   # Tell Xorg to use the nvidia driver (also valid for Wayland)
  nixpkgs.config.allowUnfreePredicate = pkg:
    builtins.elem (lib.getName pkg) [
      "nvidia-x11"
      "nvidia-settings"
    ];
 
   # Tell Xorg to use the nvidia driver
   services.xserver.videoDrivers = ["nvidia"];
   services.xserver.videoDrivers = ["nvidia"];


   hardware.nvidia = {
   hardware.nvidia = {


     # Modesetting is needed for most wayland compositors
     # Modesetting is needed for most Wayland compositors
     modesetting.enable = true;
     modesetting.enable = true;


     # Use the open source version of the kernel module
     # Use the open source version of the kernel module
     # Only available on driver 515.43.04+
     # Only available on driver 515.43.04+
     open = true;
     open = false;


     # Enable the nvidia settings menu
     # Enable the nvidia settings menu
Line 40: Line 33:
}
}
</nowiki>}}
</nowiki>}}
{{note|
Be sure to allow [[Unfree Software]]
The unfree packages from nvidia are: <code>nvidia-x11</code>, <code>nvidia-settings</code> and <code>nvidia-persistenced</code>}}
As noted in the final 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 view available version by using tab completion in the nix repl
<syntaxhighlight lang="bash">
$ nix-repl
Welcome to Nix 2.17.0pre20230701_7b39a38. Type :? for help.


As noted in the final 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].
nix-repl> :l <nixpkgs>
Added 19688 variables.


(The <code>services.xserver.videoDrivers</code> setting is also valid for wayland installations despite it's name.)
nix-repl> pkgs.linuxPackages.nvidia_x11_
</syntaxhighlight>
then hit '''TAB''' to view valid suffix's like <code>legacy470</code>


= Using GPUs on non-NixOS =
= Using GPUs on non-NixOS =