Nvidia: Difference between revisions

imported>Niobium0
Improve incorrect documentation
imported>Mdedetrich
In some cases you need to have both intel and nvidia as video drivers
Line 44: Line 44:
** no wayland support
** no wayland support


Firstly you need to enable the proprietary nvidia driver
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
{
{
   services.xserver.videoDrivers = [ "nvidia" ];
   services.xserver.videoDrivers = [ "nvidia" ];
  ...
</nowiki>}}
Note that on certain laptops and/or if you are using a custom kernel version, you may have issues with your NixOS system finding the primary display. In this case you should also specify intel in videoDrivers as well, i.e.
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
{
  services.xserver.videoDrivers = [ "intel" "nvidia" ];
  ...
</nowiki>}}
Then you need to setup the Bus ID's of the cards as seen below
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
  ...
   hardware.nvidia.optimus_prime.enable = true;
   hardware.nvidia.optimus_prime.enable = true;
   # Bus ID of the NVIDIA GPU. You can find it using lspci
   # Bus ID of the NVIDIA GPU. You can find it using lspci, either under 3D or VGA
   hardware.nvidia.optimus_prime.nvidiaBusId = "PCI:1:0:0";
   hardware.nvidia.optimus_prime.nvidiaBusId = "PCI:1:0:0";
   # Bus ID of the Intel GPU. You can find it using lspci
   # Bus ID of the Intel GPU. You can find it using lspci, either under 3D or VGA
   hardware.nvidia.optimus_prime.intelBusId = "PCI:0:2:0";
   hardware.nvidia.optimus_prime.intelBusId = "PCI:0:2:0";
 
}
}
</nowiki>}}
</nowiki>}}


An example of a final configuration is below
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
{
  services.xserver.videoDrivers = [ "intel" "nvidia" ];
  hardware.nvidia.optimus_prime.enable = true;
  # Bus ID of the NVIDIA GPU. You can find it using lspci, either under 3D or VGA
  hardware.nvidia.optimus_prime.nvidiaBusId = "PCI:1:0:0";
  # Bus ID of the Intel GPU. You can find it using lspci, either under 3D or VGA
  hardware.nvidia.optimus_prime.intelBusId = "PCI:0:2:0";
}
</nowiki>}}
== non-NixOS case ==
== non-NixOS case ==