alc8800/README.md
Tsubajashi bafd15d665 Add AIC8800 USB Wi-Fi driver as a NixOS module
This commit introduces the AIC8800 USB Wi-Fi driver, including firmware installation and configurable udev rules for USB disk ejection and power management. The driver supports kernel versions 6.17 and above, ensuring compatibility with recent changes in the Linux kernel. Documentation is also provided in README.md for usage and configuration.
2025-12-14 04:48:26 +01:00

2.6 KiB

AIC8800 USB Wi-Fi Driver for NixOS

This flake provides the AIC8800 USB Wi-Fi driver (used by UGREEN AX900 and similar adapters) as a NixOS module.

Features

  • Kernel 6.17+ compatibility (includes fixes for timer and cfg80211 API changes)
  • Automatic firmware installation
  • Configurable udev rules for USB disk ejection and power management

Usage

In your flake.nix

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    aic8800 = {
      url = "git+https://git.tvpdev.de/Tsubajashi/alc8800";
      # Or use a local path:
      # url = "path:/path/to/alc8800";
    };
  };

  outputs = { self, nixpkgs, aic8800, ... }: {
    nixosConfigurations.your-host = nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      specialArgs = {
        aic8800-src = aic8800;  # Pass the flake source
      };
      modules = [
        aic8800.nixosModules.default
        ./configuration.nix
      ];
    };
  };
}

In your configuration.nix

{
  hardware.aic8800 = {
    enable = true;
    # Optional: enable udev rules (default: true)
    enableUdevRules = true;
  };
}

Alternative: Using as a flake input with specialArgs

If you're already using aic8800-src as a flake input:

{
  inputs = {
    aic8800-src = {
      url = "git+https://git.tvpdev.de/Tsubajashi/alc8800";
      flake = false;
    };
    aic8800 = {
      url = "git+https://git.tvpdev.de/Tsubajashi/alc8800";
    };
  };

  outputs = { self, nixpkgs, aic8800, aic8800-src, ... }: {
    nixosConfigurations.your-host = nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      specialArgs = {
        aic8800-src = aic8800-src;  # Use the flake = false input
      };
      modules = [
        aic8800.nixosModules.default
        ./configuration.nix
      ];
    };
  };
}

What it does

When enabled, the module:

  1. Builds the kernel modules (aic_load_fw and aic8800_fdrv) for your kernel version
  2. Installs firmware to /lib/firmware/aic8800D80/
  3. Loads the modules automatically at boot
  4. Configures udev rules to:
    • Automatically eject USB storage devices that appear when the adapter is plugged in (switches to Wi-Fi mode)
    • Keep the Wi-Fi interface awake to avoid autosuspend issues

Kernel Compatibility

The driver includes compatibility fixes for Linux kernel 6.17+:

  • Timer API changes (del_timertimer_delete)
  • cfg80211 API changes (additional parameter for spurious frame handlers)

Troubleshooting

If you get an error about aic8800-src not being found, make sure you're passing it via specialArgs in your flake.nix.