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