Help building a wifi driver

I have a usb wifi adapter that I would like to get working on nixos. It has the driver source code available here. I’m not all that linux savy - I can get as far as

make[1]: *** /lib/modules/5.4.107/build: No such file or directory.

I’ve never worked with buildFHSUserEnv before but I realize that could be an option. I tried using it in its most basic form but that wasn’t enough. Any help would really be appreciated.

I will take a more detailed look tomorrow, but as far as I know, you will need to create a custom nix derivation for it (this would allow to recompile it with just a copy of your configuration file, and automatic recompilation when linux update). I’ll try to see what I can do based on already packaged driver like the 8821ce that I’m currently using.

For anyone looking at this, there is an updated driver here: GitHub - morrownr/8812au: Linux Driver for USB WiFi Adapters that are based on the RTL8812AU Chipset

That’s a good news. And rtl8812au is already packaged in nixos. For this, I think you would need to add in the nixos configuration file :

boot.extraModulePackages = with config.boot.kernelPackages; [
    rtl8812au
];
boot.initrd.kernelModules = [ "8812au" ];

I haven’t tested this, but this should work (and don’t forget to run nixos-rebuild switch too )

You might need to blacklist the original/generic rtl8x module.

At least I had to do it for my older Laptop.