liminix

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

default.nix (1401B)


      1 {
      2   config,
      3   pkgs,
      4   lib,
      5   ...
      6 }:
      7 let
      8   inherit (pkgs) liminix;
      9   inherit (lib) mkOption types;
     10   huawei-cdc-ncm = pkgs.kmodloader.override {
     11     targets = [ "huawei_cdc_ncm" ];
     12     inherit (config.system.outputs) kernel;
     13   };
     14 in
     15 {
     16   imports = [
     17     ../uevent-rule
     18     ../mdevd.nix
     19   ];
     20 
     21   options = {
     22     system.service.wwan.huawei-e3372 = mkOption {
     23       type = liminix.lib.types.serviceDefn;
     24     };
     25   };
     26   config = {
     27     kernel.config = {
     28       USB_NET_HUAWEI_CDC_NCM = "m";
     29       USB_USBNET = "y";
     30       USB_SERIAL = "y";
     31       USB_SERIAL_OPTION = "y";
     32     };
     33     programs.busybox.applets = [
     34       "insmod"
     35       "rmmod"
     36     ];
     37 
     38     # https://www.0xf8.org/2017/01/flashing-a-huawei-e3372h-4g-lte-stick-from-hilink-to-stick-mode/
     39     system.service.wwan.huawei-e3372 =
     40       let
     41         svc = config.system.callService ./huawei-e3372.nix {
     42           apn = mkOption { type = types.str; };
     43           username = mkOption { type = types.str; };
     44           password = mkOption { type = types.str; };
     45           authType = mkOption {
     46             type = types.enum [
     47               "pap"
     48               "chap"
     49             ];
     50           };
     51         };
     52       in
     53       svc
     54       // {
     55         build =
     56           args:
     57           let
     58             args' = args // {
     59               dependencies = (args.dependencies or [ ]) ++ [ huawei-cdc-ncm ];
     60             };
     61           in
     62           svc.build args';
     63       };
     64   };
     65 }