]> Git — Sourcephile - julm/julm-nix.git/blob - nixos/modules/mmsd.nix
nixos-fallback: make sure the script exists on the remote
[julm/julm-nix.git] / nixos / modules / mmsd.nix
1 { pkgs, lib, config, ... }:
2 with lib;
3 let
4 cfg = config.services.mmsd;
5 dbusServiceFile = pkgs.writeTextDir "share/dbus-1/services/org.ofono.mms.service" ''
6 [D-BUS Service]
7 Name=org.ofono.mms
8 SystemdService=dbus-org.ofono.mms.service
9
10 # Exec= is still required despite SystemdService= being used:
11 # https://github.com/freedesktop/dbus/blob/ef55a3db0d8f17848f8a579092fb05900cc076f5/test/data/systemd-activation/com.example.SystemdActivatable1.service
12 Exec=${pkgs.coreutils}/bin/false mmsd
13 '';
14 in
15 {
16 options.services.mmsd = {
17 enable = mkEnableOption "Multimedia Messaging Service Daemon";
18 extraArgs = mkOption {
19 type = with types; listOf str;
20 default = [];
21 example = ["--debug"];
22 };
23 };
24 config = mkIf cfg.enable {
25 services.dbus.packages = [ dbusServiceFile ];
26 systemd.user.services.mmsd = {
27 after = [ "ModemManager.service" ];
28 aliases = [ "dbus-org.ofono.mms.service" ];
29 serviceConfig = {
30 Type = "dbus";
31 ExecStart = "${pkgs.mmsd-tng}/bin/mmsdtng " + escapeShellArgs cfg.extraArgs;
32 BusName = "org.ofono.mms";
33 Restart = "on-failure";
34 };
35 };
36 };
37 }