Skip to content

Commit eac32ce

Browse files
committed
wsl-distro: introduce wsl.useWindowsDriver option
1 parent 34eda45 commit eac32ce

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

modules/wsl-distro.nix

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ in
99

1010
options.wsl = with types; {
1111
enable = mkEnableOption "support for running NixOS as a WSL distribution";
12+
useWindowsDriver = mkEnableOption "OpenGL driver from the Windows host";
1213
binShPkg = mkOption {
1314
type = package;
1415
internal = true;
@@ -70,7 +71,16 @@ in
7071
# WSL does not support virtual consoles
7172
console.enable = false;
7273

73-
hardware.opengl.enable = true; # Enable GPU acceleration
74+
hardware.opengl = {
75+
enable = true; # Enable GPU acceleration
76+
77+
extraPackages = mkIf cfg.useWindowsDriver [
78+
(pkgs.runCommand "wsl-lib" { } ''
79+
mkdir "$out"
80+
ln -s /usr/lib/wsl/lib "$out/lib"
81+
'')
82+
];
83+
};
7484

7585
environment = {
7686
# Only set the options if the files are managed by WSL

0 commit comments

Comments
 (0)