1 { config, lib, pkgs, ... }:
7 hardware.usb-modeswitch = {
8 enable = lib.mkOption {
12 Enable this option to support certain USB WLAN and WWAN adapters.
14 These network adapters initial present themselves as Flash Drives containing their drivers.
15 This option enables automatic switching to the networking mode.
24 (lib.mkRenamedOptionModule ["hardware" "usbWwan" ] ["hardware" "usb-modeswitch" ])
27 config = lib.mkIf config.hardware.usb-modeswitch.enable {
28 # Attaches device specific handlers.
29 services.udev.packages = with pkgs; [ usb-modeswitch-data ];
31 # Triggered by udev, usb-modeswitch creates systemd services via a
32 # template unit in the usb-modeswitch package.
33 systemd.packages = with pkgs; [ usb-modeswitch ];
35 # The systemd service requires the usb-modeswitch-data. The
36 # usb-modeswitch package intends to discover this via the
37 # filesystem at /usr/share/usb_modeswitch, and merge it with user
38 # configuration in /etc/usb_modeswitch.d. Configuring the correct
39 # path in the package is difficult, as it would cause a cyclic
41 environment.etc."usb_modeswitch.d".source = "${pkgs.usb-modeswitch-data}/share/usb_modeswitch";