8 cfg = config.networking.modemmanager;
12 maintainers = lib.teams.freedesktop.members;
16 networking.modemmanager = {
21 Whether to use ModemManager to manage modem devices.
22 This is usually used by some higher layer manager such as NetworkManager
23 but can be used standalone especially if using a modem for non-IP
24 connectivity (e.g. GPS).
28 package = mkPackageOption pkgs "modemmanager" { };
30 fccUnlockScripts = mkOption {
36 description = "vid:pid of either the PCI or USB vendor and product ID";
40 description = "Path to the unlock script";
46 example = literalExpression ''[{ id = "03f0:4e1d"; path = "''${pkgs.modemmanager}/share/ModemManager/fcc-unlock.available.d/03f0:4e1d"; }]'';
48 List of FCC unlock scripts to enable on the system, behaving as described in
49 https://modemmanager.org/docs/modemmanager/fcc-unlock/#integration-with-third-party-fcc-unlock-tools.
55 config = lib.mkIf cfg.enable {
56 environment.etc = builtins.listToAttrs (
59 lib.nameValuePair "ModemManager/fcc-unlock.d/${e.id}" {
62 ) cfg.fccUnlockScripts
65 systemd.services.ModemManager = {
66 aliases = [ "dbus-org.freedesktop.ModemManager1.service" ];
67 path = lib.optionals (cfg.fccUnlockScripts != [ ]) [
75 Identity=unix-group:networkmanager
76 Action=org.freedesktop.ModemManager*
81 security.polkit.enable = true;
82 security.polkit.extraConfig = ''
83 polkit.addRule(function(action, subject) {
85 subject.isInGroup("networkmanager")
86 && action.id.indexOf("org.freedesktop.ModemManager") == 0
88 { return polkit.Result.YES; }
92 environment.systemPackages = [ cfg.package ];
93 systemd.packages = [ cfg.package ];
94 services.dbus.packages = [ cfg.package ];
95 services.udev.packages = [ cfg.package ];