nvidia-container-toolkit: nvidia driver: don't enable, assert enabled (#350339)

This commit is contained in:
Someone 2024-10-22 13:13:55 +00:00 committed by GitHub
commit c53153d5b8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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" ];