2015-04-05 15:19:19 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.services.teamviewer;
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
###### interface
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
2022-08-28 20:18:44 +01:00
|
|
|
services.teamviewer.enable = mkEnableOption (lib.mdDoc "TeamViewer daemon");
|
2020-08-07 14:43:58 +01:00
|
|
|
|
2015-04-05 15:19:19 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
###### implementation
|
|
|
|
|
|
|
|
config = mkIf (cfg.enable) {
|
|
|
|
|
|
|
|
environment.systemPackages = [ pkgs.teamviewer ];
|
|
|
|
|
2021-09-30 20:27:15 +01:00
|
|
|
services.dbus.packages = [ pkgs.teamviewer ];
|
|
|
|
|
2015-04-05 15:19:19 +01:00
|
|
|
systemd.services.teamviewerd = {
|
|
|
|
description = "TeamViewer remote control daemon";
|
|
|
|
|
2015-12-03 14:56:21 +00:00
|
|
|
wantedBy = [ "multi-user.target" ];
|
2021-10-01 00:27:06 +01:00
|
|
|
after = [ "NetworkManager-wait-online.service" "network.target" "dbus.service" ];
|
|
|
|
requires = [ "dbus.service" ];
|
2015-12-03 14:56:21 +00:00
|
|
|
preStart = "mkdir -pv /var/lib/teamviewer /var/log/teamviewer";
|
2015-04-05 15:19:19 +01:00
|
|
|
|
2020-09-09 08:31:27 +01:00
|
|
|
startLimitIntervalSec = 60;
|
|
|
|
startLimitBurst = 10;
|
2015-04-05 15:19:19 +01:00
|
|
|
serviceConfig = {
|
2021-10-01 00:27:06 +01:00
|
|
|
Type = "simple";
|
|
|
|
ExecStart = "${pkgs.teamviewer}/bin/teamviewerd -f";
|
2015-04-05 15:19:19 +01:00
|
|
|
PIDFile = "/run/teamviewerd.pid";
|
|
|
|
ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
|
|
|
|
Restart = "on-abort";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|