Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load kernel modules #524

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions modules/usbip.nix
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,7 @@ in

targets.multi-user.wants = map (busid: "usbip-auto-attach@${busid}.service") cfg.autoAttach;
};

wsl.kernelModules = [ "vhci-hcd" ];
};
}
11 changes: 11 additions & 0 deletions modules/wsl-distro.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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.
'';
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can't we reuse boot.kernelModules here?

Copy link
Contributor Author

@terlar terlar Aug 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it is gated behind boot.kernel.enable which we don't want to enable.

Another option is to have something like a boolean wsl.loadKernelModules. That will write the file with the value based on boot.kernelModules. What do you prefer?

binShPkg = mkOption {
type = package;
internal = true;
Expand Down Expand Up @@ -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;
})
];
};

Expand Down
Loading