70 lines
2.3 KiB
Nix
70 lines
2.3 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
{
|
|
|
|
# Allow to use the nvidia driver in the special case
|
|
# Use in the boot menu
|
|
specialisation = {
|
|
nvidia-enabled = {
|
|
configuration = {
|
|
system.nixos.tags = [ "nvidia-enabled" ];
|
|
# Enable OpenGL
|
|
hardware.graphics = {
|
|
enable = true;
|
|
};
|
|
hardware.nvidia = {
|
|
modesetting.enable = true;
|
|
powerManagement.enable = true;
|
|
powerManagement.finegrained = false;
|
|
open = false;
|
|
nvidiaSettings = false;
|
|
|
|
prime = {
|
|
sync.enable = true;
|
|
nvidiaBusId = "PCI:1:0:0";
|
|
intelBusId = "PCI:0:2:0";
|
|
};
|
|
|
|
package = config.boot.kernelPackages.nvidiaPackages.beta;
|
|
};
|
|
# overwrite the blacklists set previously
|
|
boot.extraModprobeConfig = "";
|
|
boot.blacklistedKernelModules = [];
|
|
services.udev.extraRules = "";
|
|
services.xserver.videoDrivers = ["nvidia"];
|
|
};
|
|
};
|
|
};
|
|
|
|
|
|
# In the global configuration, we blacklist the nouveau driver and load the nvidia driver
|
|
boot.extraModprobeConfig = ''
|
|
blacklist nouveau
|
|
options nouveau modeset=0
|
|
'';
|
|
|
|
services.udev.extraRules = ''
|
|
# Remove NVIDIA USB xHCI Host Controller devices, if present
|
|
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x0c0330", ATTR{power/control}="auto", ATTR{remove}="1"
|
|
# Remove NVIDIA USB Type-C UCSI devices, if present
|
|
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x0c8000", ATTR{power/control}="auto", ATTR{remove}="1"
|
|
# Remove NVIDIA Audio devices, if present
|
|
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x040300", ATTR{power/control}="auto", ATTR{remove}="1"
|
|
# Remove NVIDIA VGA/3D controller devices
|
|
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x030000", ATTR{power/control}="auto", ATTR{remove}="1"
|
|
'';
|
|
|
|
# # Remove the whole bridge responsible for the VGA/3D controller
|
|
# ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x8086", ATTR{class}=="0x060400", ATTR{power/control}="auto", ATTR{remove}="1"
|
|
|
|
boot.blacklistedKernelModules = [ "nouveau" "nvidia" "nvidia_drm" "nvidia_modeset" ];
|
|
}
|
|
|
|
|
|
# Warning: used to have
|
|
# lib.mkdDefault
|