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