Can't get an old tp-link tl-wn823n (v1 or v2) to load properly with NixOS

Hello

I own an old tp-link usb wifi adapter tl-wn823n, it is v1 or v2 I don’t really know.
For a few days I was able to have it working but it looks unreliable to me.

With kernel 6.4.19 I get this error:

[   24.954980] usb 1-3: RTL8192EU rev B (SMIC) romver 0, 2T2R, TX queues 3, WiFi=1, BT=0, GPS=0, HI PA=0
[   24.954994] usb 1-3: RTL8192EU MAC: 18:a6:f7:09:34:40
[   24.954999] usb 1-3: rtl8xxxu: Loading firmware rtlwifi/rtl8192eu_nic.bin
[   24.955104] usb 1-3: Direct firmware load for rtlwifi/rtl8192eu_nic.bin failed with error -2
[   24.955112] usb 1-3: request_firmware(rtlwifi/rtl8192eu_nic.bin) failed
[   24.955116] usb 1-3: Fatal - failed to load firmware
[   24.957562] rtl8xxxu: probe of 1-3:1.0 failed with error -11
[   24.957623] usbcore: registered new interface driver rtl8xxxu
[   28.346121] 8021q: 802.1Q VLAN Support v1.8
[   28.656406] r8169 0000:02:00.0: Direct firmware load for rtl_nic/rtl8168h-2.fw failed with error -2
[   28.656422] r8169 0000:02:00.0: Unable to load firmware rtl_nic/rtl8168h-2.fw (-2)

I am on a pretty old as well Intel NUC with this hardware configuration + the nixos-hardware module for intel-nuc-8i7beh:

          boot.loader.systemd-boot.enable = true;
          boot.loader.efi.canTouchEfiVariables = true;
          boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "usb_storage" "usbhid" "sd_mod" ];
          boot.initrd.kernelModules = [ ];
          boot.kernelModules = [ "kvm-intel" ];
          boot.extraModulePackages = [ ];
          boot.kernelPackages = pkgs.linuxPackages_6_4;

I own a Thinkpad X1 Carbon running NixOS as well and it looks like it can run it correctly with the same Linux Kernel version

[124785.905698] usb 3-7: new high-speed USB device number 24 using xhci_hcd
[124786.032658] usb 3-7: New USB device found, idVendor=2357, idProduct=0109, bcdDevice= 2.00
[124786.032668] usb 3-7: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[124786.032671] usb 3-7: Product: 802.11n NIC
[124786.032674] usb 3-7: Manufacturer: Realtek
[124786.032676] usb 3-7: SerialNumber: 00e04c000001
[124786.102176] usb 3-7: RTL8192EU rev B (SMIC) romver 0, 2T2R, TX queues 3, WiFi=1, BT=0, GPS=0, HI PA=0
[124786.102182] usb 3-7: RTL8192EU MAC: 18:a6:f7:09:34:40
[124786.102184] usb 3-7: rtl8xxxu: Loading firmware rtlwifi/rtl8192eu_nic.bin
[124786.104131] usb 3-7: Firmware revision 35.7 (signature 0x92e1)
[124787.556187] rtl8xxxu 3-7:1.0 wlp0s20f0u7: renamed from wlan0

So I am a bit confused

It means you don’t have that file. The „linux-firmware” package should provide it. After you install it, plug in the device again and it should work.