Help loading kernel module from store

Greetings,
I’m trying to install the lenovo-legion package and associated kernel module, but can’t seem to get them to work. From my investigation, it would appear that the kernel module isn’t loading. The method I’m using is through the configuration.nix file in which I’d included:

  environment.systemPackages = with pkgs; [
    pkgs.linuxKernel.packages.linux_6_8.lenovo-legion-module
    pkgs.lenovo-legion
  ];

  boot.kernelPackages = pkgs.linuxPackages_latest;

it would appear to me that I’m missing a step or two to actually enable the kernel package from the lenovo-legion-module, but I can’t seem to figure out what to do. I’d attempted to go through the documentation at https://nixos.wiki/wiki/Linux_kernel

The custom module section suggested including

  boot.extraModulePackages = with config.boot.kernelPackages; [ lenovo-legion-module ];

but that caused an error during

sudo nixos-rebuild switch && reboot

Thank you in advance for any help or insight

Managed to solve it myself, indluding my solution for posterity:

  boot.kernelPackages = pkgs.linuxPackages_latest;
  
  environment.systemPackages = with pkgs; [
    pkgs.lenovo-legion
    pkgs.linuxKernel.packages.linux_latest_libre.lenovo-legion-module
  ];

  boot.extraModulePackages = with config.boot.kernelPackages;
    [ lenovo-legion-module ];
  
  boot.kernelModules = [ 
    "lenovo-legion-module" 
  ];