Skip to content

Commit 914cd5d

Browse files
committed
wsl-distro: introduce wsl.kernelModules option
WSL now supports kernel modules and come with a bunch configured as `m` and can be loaded this way. For example `vhci-hcd` used by usbip has changed from `y` to `m` and hence need to be explicitly loaded.
1 parent f373ad5 commit 914cd5d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

modules/wsl-distro.nix

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ in
1010
options.wsl = with types; {
1111
enable = mkEnableOption "support for running NixOS as a WSL distribution";
1212
useWindowsDriver = mkEnableOption "OpenGL driver from the Windows host";
13+
kernelModules = mkOption {
14+
type = listOf str;
15+
default = [ ];
16+
description = ''
17+
The set of kernel modules to be loaded in the second stage of
18+
the boot process via systemd-modules-load.service.
19+
'';
20+
};
1321
binShPkg = mkOption {
1422
type = package;
1523
internal = true;
@@ -109,6 +117,9 @@ in
109117
(mkIf config.wsl.wslConf.network.generateResolvConf {
110118
"resolv.conf".enable = false;
111119
})
120+
(mkIf cfg.kernelModules != [] {
121+
"modules-load.d/nixos.conf".text = concatStringsSep "\n" cfg.kernelModules;
122+
})
112123
];
113124
};
114125

0 commit comments

Comments
 (0)