Skip to content

Commit db74ebe

Browse files
committed
fix: set wsl.useWindowsDriver when the nvidia-ctk is enabled
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
1 parent 041bad0 commit db74ebe

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

modules/default.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
./build-tarball.nix
44
./docker-desktop.nix
55
./interop.nix
6+
./nvidia-container-toolkit.nix
67
./recovery.nix
78
./systemd
89
./usbip.nix

modules/nvidia.nix

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{ config, lib, ... }:
2+
{
3+
4+
config =
5+
lib.mkIf
6+
(config.wsl.enable &&
7+
(config.wsl.docker-desktop.enable ||
8+
config.virtualisation.podman.enable ||
9+
(config.virtualisation.docker.enable &&
10+
(lib.versionAtLeast config.virtualisation.docker.package.version "25"))))
11+
{
12+
13+
# Related issues:
14+
# - https://github.com/nix-community/NixOS-WSL/issues/433
15+
# - https://github.com/NVIDIA/nvidia-container-toolkit/issues/452
16+
#
17+
# By setting `useWindowsDriver` to true, the Nvidia libraries are properly
18+
# mounted on the container from the host.
19+
wsl.useWindowsDriver = lib.mkIf config.hardware.nvidia-container-toolkit.enable true;
20+
21+
};
22+
}

0 commit comments

Comments
 (0)