Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent usage of hardware.nvidia-container-toolkit.enable #249

Merged
merged 1 commit into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading