diff --git a/nixos/modules/services/hardware/nvidia-container-toolkit/default.nix b/nixos/modules/services/hardware/nvidia-container-toolkit/default.nix index 450651e8b601..3538e52bda3b 100644 --- a/nixos/modules/services/hardware/nvidia-container-toolkit/default.nix +++ b/nixos/modules/services/hardware/nvidia-container-toolkit/default.nix @@ -78,6 +78,11 @@ }; config = lib.mkIf config.hardware.nvidia-container-toolkit.enable { + assertions = [ + { assertion = config.hardware.nvidia.datacenter.enable || lib.elem "nvidia" config.services.xserver.videoDrivers; + message = ''`nvidia-container-toolkit` requires nvidia datacenter or desktop drivers: set `hardware.nvidia.datacenter.enable` or add "nvidia" to `services.xserver.videoDrivers`''; + }]; + virtualisation.docker = { daemon.settings = lib.mkIf (lib.versionAtLeast config.virtualisation.docker.package.version "25") { @@ -130,9 +135,6 @@ ]); }; - services.xserver.videoDrivers = lib.mkIf - (!config.hardware.nvidia.datacenter.enable) [ "nvidia" ]; - systemd.services.nvidia-container-toolkit-cdi-generator = { description = "Container Device Interface (CDI) for Nvidia generator"; wantedBy = [ "multi-user.target" ];