Adding thrid-party kernel module to NixOS

Good Evening,

I have recently installed NixOS on an Asus Zenbook laptop equipped with a ScreenPad, where the touchpad is an additional screen. Asus also makes laptops with a ScreenPad Plus, which is a similar implementation of a secondary screen on a laptop. There is a community built kernel module for the screenpad plus I would like to add to my NixOS system to try to gain some additional control over the Screenpad, located here. How can I add this to my NixOS configuration? Thanks.

Step 1. Package this as a kernel module package. I guess acpi_call can be a simple example (or generally look at the existing sutff in linuxPackages, defined via packagesFor = in pkgs/top-level/linux-kernel.nix)

Step 2. Test it. Build against your exact kernel as the parameter and insmod by hand. (Note that it can be out of tree and get parameters from a Nixpkgs import or something)

Step 3. Change your boot.extraModulePackages to add the new module package (possibly imported from out of tree and passed its dependencies). Ideally, it should use config.boot.kernelPackages.kernel as the kernel. Also add the module name to boot.kernelModules.

Well, if it works well, you can also open a PR to add the module package into Nixpkgs linuxPackages.