[SOLVED] How to correctly add kernel module?

Hi there,

I am trying to add the rtl8812au kernel module to my NixOS installation.
I tried boot.kernelModules = [ "rtl8812au" ]; which builds correctly but even after reboot, my device is not usable.
I also tried boot.initrd.kernelModules = [ “rtl8812au” ]; but in that case I get this error:

modprobe: FATAL: Module rtl8812au not found in directory /nix/store/6v6vwi3wy6a2cmjlhkzap62kvzchq5dr-linux-5.15.89-modules/lib/modules/5.15.89
error: builder for '/nix/store/4cz6x24s7ddkmv5b11j627chpdr0cvx3-linux-5.15.89-modules-shrunk.drv' failed with exit code 1
error: 1 dependencies of derivation '/nix/store/ppm4ngxdfa96j75msbygfn9bhsqlbnph-initrd-linux-5.15.89.drv' failed to build
error: 1 dependencies of derivation '/nix/store/q4r5nmb0h64rmva8h95vp0k0ij5davmv-nixos-system-nixos-22.11.1777.cdead16a444.drv' failed to build

In the distro I used previously I was using GitHub - aircrack-ng/rtl8812au: RTL8812AU/21AU and RTL8814AU driver with monitor mode and frame injection as a kernel module.

How do I get rtl8812au to work in NixOS?

I’d expect something like

  boot.extraModulePackages = with config.boot.kernelPackages; [

Thank you for the prompt reply. I added that but it makes no difference.

You probably need this driver:

boot.extraModulePackages = with config.boot.kernelPackages; [
1 Like

Excellent, that worked, thank you @misuzu !

1 Like