Skip to content

Commit

Permalink
Prevent usage of hardware.nvidia-container-toolkit.enable
Browse files Browse the repository at this point in the history
This option is not yet compatible with Jetson devices.
  • Loading branch information
jmbaur committed Sep 26, 2024
1 parent 4eb932f commit 60128b1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ You can run OCI containers with jetpack-nixos by enabling the following nixos op
}
```

Note that on newer nixpkgs the `virtualisation.{docker,podman}.enableNvidia` option is deprecated in favor of using `hardware.nvidia-container-toolkit.enable` instead. This new option does not work yet with Jetson devices, see [this issue](https://github.com/nixos/nixpkgs/issues/344729).

To run a container with access to nvidia hardware, you must specify a device to
passthrough to the container in the [CDI](https://github.com/cncf-tags/container-device-interface/blob/main/SPEC.md#overview)
format. By default, there will be a single device setup of the kind
Expand Down
8 changes: 6 additions & 2 deletions modules/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ let
paths = cfg.firmware.optee.supplicant.plugins;
};

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);
nvidiaDockerActive = with config.virtualisation; docker.enable && docker.enableNvidia;
nvidiaPodmanActive = with config.virtualisation; podman.enable && podman.enableNvidia;
in
{
imports = [
Expand Down Expand Up @@ -149,6 +149,10 @@ in
assertion = nvidiaDockerActive -> lib.versionAtLeast config.virtualisation.docker.package.version "25";
message = "Docker version < 25 does not support CDI";
}
{
assertion = (nvidiaDockerActive || nvidiaPodmanActive) -> (!config.hardware.nvidia-container-toolkit.enable);
message = "hardware.nvidia-container-toolkit.enable does not work with jetson devices (yet), use virtualisation.{docker,podman}.enableNvidia instead";
}
];

# Use mkOptionDefault so that we prevent conflicting with the priority that
Expand Down

0 comments on commit 60128b1

Please sign in to comment.