at 23.11-pre 1.1 kB view raw
1{ config, lib, pkgs, ... }: 2 3with lib; 4 5{ 6 ###### interface 7 8 options = { 9 10 hardware.usbWwan = { 11 enable = mkOption { 12 type = types.bool; 13 default = false; 14 description = lib.mdDoc '' 15 Enable this option to support USB WWAN adapters. 16 ''; 17 }; 18 }; 19 }; 20 21 ###### implementation 22 23 config = mkIf config.hardware.usbWwan.enable { 24 # Attaches device specific handlers. 25 services.udev.packages = with pkgs; [ usb-modeswitch-data ]; 26 27 # Triggered by udev, usb-modeswitch creates systemd services via a 28 # template unit in the usb-modeswitch package. 29 systemd.packages = with pkgs; [ usb-modeswitch ]; 30 31 # The systemd service requires the usb-modeswitch-data. The 32 # usb-modeswitch package intends to discover this via the 33 # filesystem at /usr/share/usb_modeswitch, and merge it with user 34 # configuration in /etc/usb_modeswitch.d. Configuring the correct 35 # path in the package is difficult, as it would cause a cyclic 36 # dependency. 37 environment.etc."usb_modeswitch.d".source = "${pkgs.usb-modeswitch-data}/share/usb_modeswitch"; 38 }; 39}