-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnvidia_for_MSI_sword17_laptop.nix
93 lines (81 loc) · 2.95 KB
/
nvidia_for_MSI_sword17_laptop.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# Do not modify this file! It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{
config,
pkgs,
lib,
...
}: {
# Enable OpenGL
hardware.graphics = {
enable = true;
};
environment.systemPackages = [pkgs.lshw pkgs.lshw-gui];
# Load nvidia driver for Xorg and Wayland
services.xserver.videoDrivers = ["nvidia"];
hardware.nvidia = {
# Modesetting is required.
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;
# 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;
# Use the NVidia open source kernel module (not to be confused with the
# independent third-party "nouveau" open source driver).
# Support is limited to the Turing and later architectures. Full list of
# supported GPUs is at:
# https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus
# Only available from driver 515.43.04+
# Currently alpha-quality/buggy, so false is currently the recommended setting.
open = true;
# Enable the Nvidia settings menu,
# accessible via `nvidia-settings`.
nvidiaSettings = true;
prime = {
intelBusId = "PCI:0:2:0";
nvidiaBusId = "PCI:1:0:0";
#amdgpuBusId = "PCI:54:0:0"; # If you have an AMD iGPU
sync.enable = true;
};
# Optionally, you may need to select the appropriate driver version for your specific GPU.
package = config.boot.kernelPackages.nvidiaPackages.stable;
};
specialisation.nvidia-PRIME-offload.configuration = {
system.nixos.tags = ["nvidia-PRIME-offload-best-battery"];
hardware.nvidia.prime = {
offload = {
enable = lib.mkForce true;
enableOffloadCmd = lib.mkForce true;
};
sync.enable = lib.mkForce false;
reverseSync.enable = lib.mkForce false;
};
};
specialisation.nvidia-PRIME-sync.configuration = {
system.nixos.tags = ["nvidia-PRIME-sync-best-performance"];
hardware.nvidia.prime = {
offload = {
enable = lib.mkForce false;
enableOffloadCmd = lib.mkForce false;
};
sync.enable = lib.mkForce true;
reverseSync.enable = lib.mkForce false;
};
};
specialisation.nvidia-PRIME-reverse-sync.configuration = {
system.nixos.tags = ["nvidia-PRIME-reverse-sync-EXPERIMENTAL"];
hardware.nvidia.prime = {
offload = {
enable = lib.mkForce false;
enableOffloadCmd = lib.mkForce false;
};
sync.enable = lib.mkForce false;
reverseSync.enable = lib.mkForce true;
};
};
}