From 0e1249235b35ed071a4597123d9d8178ad91dfc4 Mon Sep 17 00:00:00 2001 From: 0xTux <0xtux@pm.me> Date: Tue, 30 Jul 2024 16:36:35 +0530 Subject: [PATCH] enable cuda in wsl --- hosts/wsl/default.nix | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/hosts/wsl/default.nix b/hosts/wsl/default.nix index 92bcbcd..9fbcb3e 100644 --- a/hosts/wsl/default.nix +++ b/hosts/wsl/default.nix @@ -2,16 +2,24 @@ pkgs, inputs, username, + config, ... }: { imports = [ inputs.nixos-wsl.nixosModules.wsl ]; - nixpkgs.hostPlatform = "x86_64-linux"; + nixpkgs = { + config.cudaSupport = true; + hostPlatform = "x86_64-linux"; + }; - wsl.enable = true; - wsl.defaultUser = "${username}"; + wsl = { + enable = true; + defaultUser = "${username}"; + nativeSystemd = true; + useWindowsDriver = true; + }; nix = { settings = { @@ -25,12 +33,18 @@ programs = { ssh.startAgent = true; zsh.enable = true; - nix-ld.enable = true; + nix-ld = { + enable = true; + libraries = config.hardware.opengl.extraPackages; + }; dconf.enable = true; }; services = { - ollama.enable = true; + ollama = { + enable = true; + acceleration = "cuda"; + }; openssh = { enable = true; settings = {