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

fix: set wsl.useWindowsDriver when the nvidia-ctk is enabled #478

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ereslibre
Copy link

This improves the user experience as whenever the user enables the config.hardware.nvidia-container-toolkit.enable option, they cannot use their Nvidia GPU's within the Docker containers because of missing libraries.

This gets fixed by setting wsl.useWindowsDriver explicitly when the user requests to enable GPU support on Docker containers.

Issue and fix provided by @qwqawawow

Related: #433
Related: NVIDIA/nvidia-container-toolkit#452


Note: unsure if this is the right approach for this project. I am the maintainer of the CDI-generation for NixOS, and we got a couple of reports that users could not use their GPU's inside Docker containers.

I cannot test it since I don't use NixOS-WSL, but I thought it would be good to improve the user experience here a bit if possible.

Thanks :)

@loicreynier
Copy link

I just tested this following NixOS/nixpkgs#312253 and can confirm it works fine with config.hardware.nvidia-container-toolkit.enable.

However, I don't think this should be limited only to wsl.docker-desktop.enable, since Podman users, for example, may want this feature by default without having to install Docker on their system.

@ereslibre
Copy link
Author

Thanks a lot for checking @loicreynier! Good point, I have updated the PR to take into account config.virtualisation.podman.enable and config.virtualisation.docker.enable if the docker package supports CDI (Docker >= 25).

modules/default.nix Outdated Show resolved Hide resolved
modules/nvidia-container-toolkit.nix Outdated Show resolved Hide resolved
modules/nvidia-container-toolkit.nix Outdated Show resolved Hide resolved
modules/nvidia-container-toolkit.nix Outdated Show resolved Hide resolved
@loicreynier
Copy link

Looks good to me! Tested on a Podman setup and works as expected.

This improves the user experience as whenever the user enables the
`config.hardware.nvidia-container-toolkit.enable` option, they cannot
use their Nvidia GPU's within the Docker containers because of missing
libraries.

This gets fixed by setting `wsl.useWindowsDriver` explicitly when the
user requests to enable GPU support on Docker containers.

Issue and fix provided by @qwqawawow

Related: nix-community#433
Related: NVIDIA/nvidia-container-toolkit#452
573 added a commit to 573/nix-config-1 that referenced this pull request May 24, 2024
- Update neovim-nightly-flake
- Update docker used in Nixos-WSL to use v25 and
  nvidia-container-toolkit (nix-community/NixOS-WSL#478)
- reorganize emacs-novelist (still WIP) as scaffold to analyse
  extraPackages further
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants