Skip to content

Commit

Permalink
fix: set wsl.useWindowsDriver when the nvidia-ctk is enabled
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ereslibre committed May 20, 2024
1 parent 041bad0 commit 5069440
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions modules/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
./build-tarball.nix
./docker-desktop.nix
./interop.nix
./nvidia.nix
./recovery.nix
./systemd
./usbip.nix
Expand Down
24 changes: 24 additions & 0 deletions modules/nvidia.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{ config, lib, ... }:
{

config =
lib.mkIf
(
config.wsl.enable &&
(config.wsl.docker-desktop.enable ||
config.virtualisation.podman.enable ||
(config.virtualisation.docker.enable &&
(lib.versionAtLeast config.virtualisation.docker.package.version "25")))
)
{

# Related issues:
# - https://github.com/nix-community/NixOS-WSL/issues/433
# - https://github.com/NVIDIA/nvidia-container-toolkit/issues/452
#
# By setting `useWindowsDriver` to true, the Nvidia libraries are properly
# mounted on the container from the host.
wsl.useWindowsDriver = lib.mkIf config.hardware.nvidia-container-toolkit.enable true;

};
}

0 comments on commit 5069440

Please sign in to comment.