From 8628e78a62471664821ca2655375c44ac23ff747 Mon Sep 17 00:00:00 2001 From: Terje Larsen Date: Wed, 31 Jul 2024 07:23:38 +0200 Subject: [PATCH 1/2] 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. --- modules/wsl-distro.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) 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; + }) ]; }; From 94010f27fd6749ca8c07aaf584b62702c4747391 Mon Sep 17 00:00:00 2001 From: Terje Larsen Date: Wed, 31 Jul 2024 07:28:30 +0200 Subject: [PATCH 2/2] usbip: enable vhci-hcd module --- modules/usbip.nix | 2 ++ 1 file changed, 2 insertions(+) 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" ]; }; }