mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-30 02:42:59 +00:00
6afb255d97
these changes were generated with nixq 0.0.2, by running nixq ">> lib.mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix nixq ">> mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix nixq ">> Inherit >> mdDoc[remove]" --batchmode nixos/**.nix two mentions of the mdDoc function remain in nixos/, both of which are inside of comments. Since lib.mdDoc is already defined as just id, this commit is a no-op as far as Nix (and the built manual) is concerned.
47 lines
1.4 KiB
Nix
47 lines
1.4 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
{
|
|
###### interface
|
|
|
|
options = {
|
|
|
|
hardware.usb-modeswitch = {
|
|
enable = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
description = ''
|
|
Enable this option to support certain USB WLAN and WWAN adapters.
|
|
|
|
These network adapters initial present themselves as Flash Drives containing their drivers.
|
|
This option enables automatic switching to the networking mode.
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
|
|
###### implementation
|
|
|
|
imports = [
|
|
(mkRenamedOptionModule ["hardware" "usbWwan" ] ["hardware" "usb-modeswitch" ])
|
|
];
|
|
|
|
config = mkIf config.hardware.usb-modeswitch.enable {
|
|
# Attaches device specific handlers.
|
|
services.udev.packages = with pkgs; [ usb-modeswitch-data ];
|
|
|
|
# Triggered by udev, usb-modeswitch creates systemd services via a
|
|
# template unit in the usb-modeswitch package.
|
|
systemd.packages = with pkgs; [ usb-modeswitch ];
|
|
|
|
# The systemd service requires the usb-modeswitch-data. The
|
|
# usb-modeswitch package intends to discover this via the
|
|
# filesystem at /usr/share/usb_modeswitch, and merge it with user
|
|
# configuration in /etc/usb_modeswitch.d. Configuring the correct
|
|
# path in the package is difficult, as it would cause a cyclic
|
|
# dependency.
|
|
environment.etc."usb_modeswitch.d".source = "${pkgs.usb-modeswitch-data}/share/usb_modeswitch";
|
|
};
|
|
}
|