From 97fa52c1394f0620fa1c522e6765f1211b1ba52b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Fern=C3=A1ndez=20L=C3=B3pez?= Date: Mon, 20 May 2024 17:21:42 +0200 Subject: [PATCH] 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: https://github.com/nix-community/NixOS-WSL/issues/433 Related: https://github.com/NVIDIA/nvidia-container-toolkit/issues/452 --- modules/docker-desktop.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/docker-desktop.nix b/modules/docker-desktop.nix index e2ae0769..6378c70b 100644 --- a/modules/docker-desktop.nix +++ b/modules/docker-desktop.nix @@ -36,6 +36,14 @@ with builtins; with lib; { config.wsl.defaultUser ]; + # 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 = mkIf config.hardware.nvidia-container-toolkit.enable true; + }; }