2025-02-10 21:55:08 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}:
|
2024-05-14 21:19:34 +00:00
|
|
|
let
|
2024-05-15 16:36:16 +00:00
|
|
|
inherit (pkgs) liminix;
|
|
|
|
inherit (lib) mkOption types;
|
2024-07-14 11:07:28 +00:00
|
|
|
huawei-cdc-ncm = pkgs.kmodloader.override {
|
2025-02-10 21:55:08 +00:00
|
|
|
targets = [ "huawei_cdc_ncm" ];
|
2024-07-14 11:07:28 +00:00
|
|
|
inherit (config.system.outputs) kernel;
|
|
|
|
};
|
2025-02-10 21:55:08 +00:00
|
|
|
in
|
|
|
|
{
|
2024-06-02 17:27:59 +00:00
|
|
|
imports = [
|
2024-07-28 21:35:37 +00:00
|
|
|
../uevent-rule
|
2024-07-23 08:19:23 +00:00
|
|
|
../mdevd.nix
|
2024-06-02 17:27:59 +00:00
|
|
|
];
|
|
|
|
|
2024-05-15 16:36:16 +00:00
|
|
|
options = {
|
2024-07-14 10:53:45 +00:00
|
|
|
system.service.wwan.huawei-e3372 = mkOption {
|
2024-05-15 16:36:16 +00:00
|
|
|
type = liminix.lib.types.serviceDefn;
|
|
|
|
};
|
|
|
|
};
|
2024-05-14 17:07:33 +00:00
|
|
|
config = {
|
|
|
|
kernel.config = {
|
2024-07-14 11:07:28 +00:00
|
|
|
USB_NET_HUAWEI_CDC_NCM = "m";
|
2024-05-14 17:07:33 +00:00
|
|
|
USB_USBNET = "y";
|
|
|
|
USB_SERIAL = "y";
|
|
|
|
USB_SERIAL_OPTION = "y";
|
|
|
|
};
|
2024-07-15 21:35:26 +00:00
|
|
|
programs.busybox.applets = [
|
2025-02-10 21:55:08 +00:00
|
|
|
"insmod"
|
|
|
|
"rmmod"
|
2024-07-15 21:35:26 +00:00
|
|
|
];
|
2024-05-14 17:07:33 +00:00
|
|
|
|
2024-05-14 21:19:34 +00:00
|
|
|
# https://www.0xf8.org/2017/01/flashing-a-huawei-e3372h-4g-lte-stick-from-hilink-to-stick-mode/
|
2024-07-14 11:07:28 +00:00
|
|
|
system.service.wwan.huawei-e3372 =
|
2025-02-10 21:55:08 +00:00
|
|
|
let
|
|
|
|
svc = config.system.callService ./huawei-e3372.nix {
|
|
|
|
apn = mkOption { type = types.str; };
|
|
|
|
username = mkOption { type = types.str; };
|
|
|
|
password = mkOption { type = types.str; };
|
|
|
|
authType = mkOption {
|
|
|
|
type = types.enum [
|
|
|
|
"pap"
|
|
|
|
"chap"
|
|
|
|
];
|
2024-07-14 11:07:28 +00:00
|
|
|
};
|
|
|
|
};
|
2025-02-10 21:55:08 +00:00
|
|
|
in
|
|
|
|
svc
|
|
|
|
// {
|
|
|
|
build =
|
|
|
|
args:
|
|
|
|
let
|
|
|
|
args' = args // {
|
|
|
|
dependencies = (args.dependencies or [ ]) ++ [ huawei-cdc-ncm ];
|
|
|
|
};
|
|
|
|
in
|
|
|
|
svc.build args';
|
|
|
|
};
|
2024-05-14 17:07:33 +00:00
|
|
|
};
|
|
|
|
}
|