1# Ofono daemon.
2{ config, lib, pkgs, ... }:
3
4with lib;
5
6let
7
8 cfg = config.services.ofono;
9
10 plugin_path =
11 lib.concatMapStringsSep ":"
12 (plugin: "${plugin}/lib/ofono/plugins")
13 cfg.plugins
14 ;
15
16in
17
18{
19 ###### interface
20 options = {
21 services.ofono = {
22 enable = mkEnableOption (lib.mdDoc "Ofono");
23
24 plugins = mkOption {
25 type = types.listOf types.package;
26 default = [];
27 example = literalExpression "[ pkgs.modem-manager-gui ]";
28 description = lib.mdDoc ''
29 The list of plugins to install.
30 '';
31 };
32 };
33 };
34
35 ###### implementation
36 config = mkIf cfg.enable {
37 services.dbus.packages = [ pkgs.ofono ];
38
39 systemd.packages = [ pkgs.ofono ];
40
41 systemd.services.ofono.environment.OFONO_PLUGIN_PATH = mkIf (cfg.plugins != []) plugin_path;
42
43 };
44}