Skip to content

Commit

Permalink
Support new nvidia-ctk option
Browse files Browse the repository at this point in the history
When checking to see if we should generate the CDI support files, we
should also check for the new `hardware.nvidia-container-toolkit.enable`
option, since the `enableNvidia` options were deprecated.
  • Loading branch information
jmbaur committed Sep 26, 2024
1 parent 776c1d4 commit 8bb204e
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions modules/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ let
paths = cfg.firmware.optee.supplicant.plugins;
};

nvidiaContainerRuntimeActive =
with config.virtualisation;
(docker.enable && docker.enableNvidia) || (podman.enable && podman.enableNvidia);
nvidiaDockerActive = with config.virtualisation; docker.enable && (docker.enableNvidia || config.hardware.nvidia-container-toolkit.enable);
nvidiaPodmanActive = with config.virtualisation; podman.enable && (podman.enableNvidia || config.hardware.nvidia-container-toolkit.enable);
in
{
imports = [
Expand Down Expand Up @@ -147,9 +146,7 @@ in
'';
}
{
assertion =
(config.virtualisation.docker.enable && config.virtualisation.docker.enableNvidia)
-> lib.versionAtLeast config.virtualisation.docker.package.version "25";
assertion = nvidiaDockerActive -> lib.versionAtLeast config.virtualisation.docker.package.version "25";
message = "Docker version < 25 does not support CDI";
}
];
Expand Down Expand Up @@ -330,7 +327,7 @@ in
];

systemd.services.nvidia-cdi-generate = {
enable = nvidiaContainerRuntimeActive;
enable = nvidiaDockerActive || nvidiaPodmanActive;
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
Expand Down

0 comments on commit 8bb204e

Please sign in to comment.