diff --git a/nixos/modules/hardware/video/nvidia.nix b/nixos/modules/hardware/video/nvidia.nix index 2be9da8f42a1..1e125eced2cb 100644 --- a/nixos/modules/hardware/video/nvidia.nix +++ b/nixos/modules/hardware/video/nvidia.nix @@ -179,28 +179,41 @@ in You cannot configure both an Intel iGPU and an AMD APU. Pick the one corresponding to your processor. ''; } + { assertion = primeEnabled -> pCfg.nvidiaBusId != "" && (pCfg.intelBusId != "" || pCfg.amdgpuBusId != ""); message = '' When NVIDIA PRIME is enabled, the GPU bus IDs must configured. ''; } + { assertion = offloadCfg.enable -> versionAtLeast nvidia_x11.version "435.21"; message = "NVIDIA PRIME render offload is currently only supported on versions >= 435.21."; } + { assertion = !(syncCfg.enable && offloadCfg.enable); message = "Only one NVIDIA PRIME solution may be used at a time."; } + { assertion = !(syncCfg.enable && cfg.powerManagement.finegrained); message = "Sync precludes powering down the NVIDIA GPU."; } + { assertion = cfg.powerManagement.enable -> offloadCfg.enable; message = "Fine-grained power management requires offload to be enabled."; } + + { + assertion = cfg.powerManagement.enable -> ( + builtins.pathExists (cfg.package.out + "/bin/nvidia-sleep.sh") && + builtins.pathExists (cfg.package.out + "/lib/systemd/system-sleep/nvidia") + ); + message = "Required files for driver based power management don't exist."; + } ]; # If Optimus/PRIME is enabled, we: