NVIDIA: Difference between revisions
imported>Qmuki fix typo that results in path not found |
imported>Gerg-L No edit summary |
||
| Line 3: | Line 3: | ||
{{file|/etc/nixos/configuration.nix|nix|<nowiki> | {{file|/etc/nixos/configuration.nix|nix|<nowiki> | ||
{ | { | ||
# Make sure opengl is enabled | |||
hardware.opengl = { | |||
enable = true; | |||
driSupport = true; | |||
driSupport32Bit = true; | |||
}; | |||
# NVIDIA drivers are unfree. | # NVIDIA drivers are unfree. | ||
nixpkgs.config. | nixpkgs.config.allowUnfreePredicate = pkg: | ||
builtins.elem (lib.getName pkg) [ | |||
"nvidia-x11" | |||
]; | |||
# Tell Xorg to use the nvidia driver | |||
services.xserver.videoDrivers = ["nvidia"]; | |||
hardware.nvidia = { | |||
# Modesetting is needed for most wayland compositors | |||
modesetting.enable = true; | |||
# Use the open source version of the kernel module | |||
open = true; | |||
# Enable the nvidia settings menu | |||
nvidiaSettings = true; | |||
# Optionally, you may need to select the appropriate driver version for your specific GPU. | |||
package = config.boot.kernelPackages.nvidiaPackages.stable; | |||
}; | |||
... | ... | ||
} | } | ||
| Line 55: | Line 75: | ||
=== Nvidia PRIME === | === Nvidia PRIME === | ||
Official solution by nvidia | The Official solution by nvidia. | ||
==== offload mode ==== | ==== offload mode ==== | ||
| Line 150: | Line 170: | ||
{{file|/etc/nixos/configuration.nix|nix|<nowiki> | {{file|/etc/nixos/configuration.nix|nix|<nowiki> | ||
{ | { | ||
services.xserver.videoDrivers = ["nvidia"]; | |||
hardware.nvidia.prime = { | hardware.nvidia.prime = { | ||
offload | offload = { | ||
enable = true; | |||
enableOffloadCmd = true; | |||
}; | |||
intelBusId = "PCI:0:2:0"; | intelBusId = "PCI:0:2:0"; | ||
nvidiaBusId = "PCI:1:0:0"; | nvidiaBusId = "PCI:1:0:0"; | ||
}; | }; | ||
| Line 185: | Line 193: | ||
external-display.configuration = { | external-display.configuration = { | ||
system.nixos.tags = [ "external-display" ]; | system.nixos.tags = [ "external-display" ]; | ||
hardware.nvidia | hardware.nvidia = { | ||
prime.offload.enable = lib.mkForce false; | |||
powerManagement.enable = lib.mkForce false; | |||
}; | |||
}; | }; | ||
}; | }; | ||
| Line 231: | Line 241: | ||
* Black screen after system upgrade (e.g. <code>nixos-rebuild switch</code>; use <code>nixos-rebuild boot</code> instead and reboot) | * Black screen after system upgrade (e.g. <code>nixos-rebuild switch</code>; use <code>nixos-rebuild boot</code> instead and reboot) | ||
* No video playback acceleration available (vaapi) | * No video playback acceleration available (vaapi) | ||
{{file|/etc/nixos/configuration.nix|nix|<nowiki> | {{file|/etc/nixos/configuration.nix|nix|<nowiki> | ||
| Line 238: | Line 246: | ||
hardware.nvidia.modesetting.enable = true; | hardware.nvidia.modesetting.enable = true; | ||
services.xserver.videoDrivers = [ "nvidia" ]; | services.xserver.videoDrivers = [ "nvidia" ]; | ||
hardware.nvidia. | hardware.nvidia.prime = { | ||
enable = true; | sync.enable = true; | ||
nvidiaBusId = "PCI:1:0:0"; | nvidiaBusId = "PCI:1:0:0"; | ||
intelBusId = "PCI:0:2:0"; | intelBusId = "PCI:0:2:0"; | ||
}; | }; | ||
| Line 250: | Line 255: | ||
</nowiki>}} | </nowiki>}} | ||
==== | ==== reverse sync mode ==== | ||
Warning: This feature is relatively new, depending on your system this might work poorly. AMD support, especially so. See: https://forums.developer.nvidia.com/t/the-all-new-outputsink-feature-aka-reverse-prime/129828 | |||
Only works with <code>services.xserver.displayManager.setupCommands</code> compatible Display Managers (LightDM, GDM and SDDM). | |||
{{file|/etc/nixos/configuration.nix|nix|<nowiki> | {{file|/etc/nixos/configuration.nix|nix|<nowiki> | ||
{ | { | ||
services.xserver.videoDrivers = [ "nvidia" ]; | services.xserver.videoDrivers = ["nvidia"]; | ||
hardware.nvidia = { | |||
# Modesetting should be enabled to prevent screen tearing | |||
modesetting.enable = true; | |||
# Reverse sync is not compatible with the open source kernel module | |||
open = false; | |||
prime = { | |||
reverseSync.enable = true; | |||
#enable if using an external GPU | |||
allowExternalGpu = false; | |||
intelBusId = "PCI:0:2:0"; | |||
nvidiaBusId = "PCI:1:0:0"; | |||
}; | |||
}; | }; | ||
} | } | ||