summary refs log tree commit diff
path: root/nixos/modules/hardware
diff options
context:
space:
mode:
authorEdmund Wu <fangkazuto@gmail.com>2021-07-26 16:48:50 -0400
committerEdmund Wu <fangkazuto@gmail.com>2021-08-07 01:41:58 -0400
commit573aae39e2d6e88da47778ff323b3471b3549d6d (patch)
treef201b921571416f1fd71c1364f157ea9cfab45c9 /nixos/modules/hardware
parent4fb40709eb7ca695cf4a7b23d4dc44bc1760c101 (diff)
downloadnixpkgs-573aae39e2d6e88da47778ff323b3471b3549d6d.tar
nixpkgs-573aae39e2d6e88da47778ff323b3471b3549d6d.tar.gz
nixpkgs-573aae39e2d6e88da47778ff323b3471b3549d6d.tar.bz2
nixpkgs-573aae39e2d6e88da47778ff323b3471b3549d6d.tar.lz
nixpkgs-573aae39e2d6e88da47778ff323b3471b3549d6d.tar.xz
nixpkgs-573aae39e2d6e88da47778ff323b3471b3549d6d.tar.zst
nixpkgs-573aae39e2d6e88da47778ff323b3471b3549d6d.zip
nixos/modules: assertion for required PM files
Diffstat (limited to 'nixos/modules/hardware')
-rw-r--r--nixos/modules/hardware/video/nvidia.nix13
1 files changed, 13 insertions, 0 deletions
diff --git a/nixos/modules/hardware/video/nvidia.nix b/nixos/modules/hardware/video/nvidia.nix
index 2be9da8f42a..1e125eced2c 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: