switch to two boot modes: with or without dgpu
This commit is contained in:
parent
bbfec6ea9a
commit
b2a1f39893
@ -6,38 +6,31 @@
|
|||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
|
|
||||||
|
# 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
|
# Enable OpenGL
|
||||||
hardware.graphics = {
|
hardware.graphics = {
|
||||||
enable = true;
|
enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
# Load nvidia driver for Xorg and Wayland
|
|
||||||
services.xserver.videoDrivers = ["nvidia"];
|
|
||||||
|
|
||||||
# specify nvidia driver version
|
|
||||||
hardware.nvidia = {
|
hardware.nvidia = {
|
||||||
|
prime = {
|
||||||
|
sync.enable = true;
|
||||||
|
# reverseSync.enable = true;
|
||||||
|
# allowExternalGpu = false;
|
||||||
|
nvidiaBusId = "PCI:1:0:0";
|
||||||
|
intelBusId = "PCI:0:2:0";
|
||||||
|
|
||||||
# Modesetting is required.
|
};
|
||||||
modesetting.enable = true;
|
modesetting.enable = true;
|
||||||
|
|
||||||
# Nvidia power management. Experimental, and can cause sleep/suspend to fail.
|
|
||||||
# Enable this if you have graphical corruption issues or application crashes after waking
|
|
||||||
# up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead
|
|
||||||
# of just the bare essentials.
|
|
||||||
powerManagement.enable = false;
|
powerManagement.enable = false;
|
||||||
|
|
||||||
# Fine-grained power management. Turns off GPU when not in use.
|
|
||||||
# Experimental and only works on modern Nvidia GPUs (Turing or newer).
|
|
||||||
powerManagement.finegrained = false;
|
powerManagement.finegrained = false;
|
||||||
|
|
||||||
# the open source drivers are not compatible with the old 1050ti
|
|
||||||
open = false;
|
open = false;
|
||||||
|
nvidiaSettings = false;
|
||||||
|
|
||||||
# Enable the Nvidia settings menu,
|
|
||||||
# accessible via `nvidia-settings`.
|
|
||||||
nvidiaSettings = true;
|
|
||||||
|
|
||||||
# Optionally, you may need to select the appropriate driver version for your specific GPU.
|
|
||||||
package = config.boot.kernelPackages.nvidiaPackages.mkDriver {
|
package = config.boot.kernelPackages.nvidiaPackages.mkDriver {
|
||||||
version = "565.77"; # latest
|
version = "565.77"; # latest
|
||||||
sha256_64bit = "sha256-CnqnQsRrzzTXZpgkAtF7PbH9s7wbiTRNcM0SPByzFHw=";
|
sha256_64bit = "sha256-CnqnQsRrzzTXZpgkAtF7PbH9s7wbiTRNcM0SPByzFHw=";
|
||||||
@ -46,14 +39,34 @@
|
|||||||
settingsSha256 = "sha256-VUetj3LlOSz/LB+DDfMCN34uA4bNTTpjDrb6C6Iwukk=";
|
settingsSha256 = "sha256-VUetj3LlOSz/LB+DDfMCN34uA4bNTTpjDrb6C6Iwukk=";
|
||||||
persistencedSha256 = "sha256-wnDjC099D8d9NJSp9D0CbsL+vfHXyJFYYgU3CwcqKww=";
|
persistencedSha256 = "sha256-wnDjC099D8d9NJSp9D0CbsL+vfHXyJFYYgU3CwcqKww=";
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
prime = {
|
boot.extraModprobeConfig = "";
|
||||||
offload = {
|
boot.blacklistedKernelModules = [];
|
||||||
enable = true;
|
services.udev.extraRules = "";
|
||||||
enableOffloadCmd = true;
|
services.xserver.videoDrivers = ["nvidia"];
|
||||||
};
|
|
||||||
intelBusId = "PCI:0:2:0";
|
|
||||||
nvidiaBusId = "PCI:1:0:0";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
# In the global configuration, we blacklist the nouveau driver and load the nvidia driver
|
||||||
|
boot.extraModprobeConfig = lib.mkDefault ''
|
||||||
|
blacklist nouveau
|
||||||
|
options nouveau modeset=0
|
||||||
|
'';
|
||||||
|
|
||||||
|
services.udev.extraRules = lib.mkDefault ''
|
||||||
|
# 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"
|
||||||
|
'';
|
||||||
|
|
||||||
|
boot.blacklistedKernelModules = lib.mkDefault [ "nouveau" "nvidia" "nvidia_drm" "nvidia_modeset" ];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user