diff --git a/modules/usbip.nix b/modules/usbip.nix index 411bce28..dff4391d 100644 --- a/modules/usbip.nix +++ b/modules/usbip.nix @@ -59,5 +59,7 @@ in targets.multi-user.wants = map (busid: "usbip-auto-attach@${busid}.service") cfg.autoAttach; }; + + wsl.kernelModules = [ "vhci-hcd" ]; }; } diff --git a/modules/wsl-distro.nix b/modules/wsl-distro.nix index f3299eb4..071a4556 100644 --- a/modules/wsl-distro.nix +++ b/modules/wsl-distro.nix @@ -10,6 +10,14 @@ in options.wsl = with types; { enable = mkEnableOption "support for running NixOS as a WSL distribution"; useWindowsDriver = mkEnableOption "OpenGL driver from the Windows host"; + kernelModules = mkOption { + type = listOf str; + default = [ ]; + description = '' + The set of kernel modules to be loaded in the second stage of + the boot process via systemd-modules-load.service. + ''; + }; binShPkg = mkOption { type = package; internal = true; @@ -109,6 +117,9 @@ in (mkIf config.wsl.wslConf.network.generateResolvConf { "resolv.conf".enable = false; }) + (mkIf (cfg.kernelModules != [ ]) { + "modules-load.d/nixos.conf".text = concatStringsSep "\n" cfg.kernelModules; + }) ]; };