❄️ Dotfiles for our NixOS system configuration.
1{
2 lib,
3 config,
4 ...
5}:
6{
7 options.settings.hardware.nvidia.enable = lib.mkEnableOption "Nvidia driver support";
8
9 config = lib.mkIf config.settings.hardware.nvidia.enable {
10 # Load NVIDIA driver for X11 and Wayland
11 services.xserver.videoDrivers = [ "nvidia" ];
12
13 hardware.nvidia = {
14 open = false;
15
16 package = config.boot.kernelPackages.nvidiaPackages.beta;
17 powerManagement = {
18 enable = false;
19 finegrained = true;
20 };
21
22 # # Ensure the kernel doesn't tear down the card/driver prior to X startup due to the card powering down.
23 # nvidiaPersistenced = true;
24
25 # the following is required for amdgpu/nvidia pairings.
26 modesetting.enable = true;
27 prime = {
28 offload.enable = true;
29
30 # Bus ID of AMD and NVIDIA GPUs.
31 amdgpuBusId = "PCI:6:0:0";
32 nvidiaBusId = "PCI:1:0:0";
33 };
34 };
35 };
36}