Skip to content

Commit 4eb932f

Browse files
jmbaurdanielfullmer
authored andcommitted
Support new nvidia-ctk option
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.
1 parent 306d921 commit 4eb932f

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

modules/default.nix

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,8 @@ let
2525
paths = cfg.firmware.optee.supplicant.plugins;
2626
};
2727

28-
nvidiaContainerRuntimeActive =
29-
with config.virtualisation;
30-
(docker.enable && docker.enableNvidia) || (podman.enable && podman.enableNvidia);
28+
nvidiaDockerActive = with config.virtualisation; docker.enable && (docker.enableNvidia || config.hardware.nvidia-container-toolkit.enable);
29+
nvidiaPodmanActive = with config.virtualisation; podman.enable && (podman.enableNvidia || config.hardware.nvidia-container-toolkit.enable);
3130
in
3231
{
3332
imports = [
@@ -147,9 +146,7 @@ in
147146
'';
148147
}
149148
{
150-
assertion =
151-
(config.virtualisation.docker.enable && config.virtualisation.docker.enableNvidia)
152-
-> lib.versionAtLeast config.virtualisation.docker.package.version "25";
149+
assertion = nvidiaDockerActive -> lib.versionAtLeast config.virtualisation.docker.package.version "25";
153150
message = "Docker version < 25 does not support CDI";
154151
}
155152
];
@@ -330,7 +327,7 @@ in
330327
];
331328

332329
systemd.services.nvidia-cdi-generate = {
333-
enable = nvidiaContainerRuntimeActive;
330+
enable = nvidiaDockerActive || nvidiaPodmanActive;
334331
serviceConfig = {
335332
Type = "oneshot";
336333
RemainAfterExit = true;

0 commit comments

Comments
 (0)