mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-05 04:23:47 +00:00
04dbbd4365
Teamviewer only works with its daemon. Therefore, having programs.teamviewer.enable is not the design currently chosen to add teamviewer. Instead, the servies.teamviewer.enable option enables both the daemon and the system package.
44 lines
1.1 KiB
Nix
44 lines
1.1 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
let
|
|
cfg = config.services.teamviewer;
|
|
in
|
|
{
|
|
options = {
|
|
services.teamviewer = {
|
|
enable = lib.mkEnableOption "TeamViewer daemon & system package";
|
|
package = lib.mkPackageOption pkgs "teamviewer" { };
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf (cfg.enable) {
|
|
environment.systemPackages = [ cfg.package ];
|
|
|
|
services.dbus.packages = [ cfg.package ];
|
|
|
|
systemd.services.teamviewerd = {
|
|
description = "TeamViewer remote control daemon";
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
wants = [ "network-online.target" ];
|
|
after = [
|
|
"network-online.target"
|
|
"network.target"
|
|
"dbus.service"
|
|
];
|
|
requires = [ "dbus.service" ];
|
|
preStart = "mkdir -pv /var/lib/teamviewer /var/log/teamviewer";
|
|
|
|
startLimitIntervalSec = 60;
|
|
startLimitBurst = 10;
|
|
serviceConfig = {
|
|
Type = "simple";
|
|
ExecStart = "${cfg.package}/bin/teamviewerd -f";
|
|
PIDFile = "/run/teamviewerd.pid";
|
|
ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
|
|
Restart = "on-abort";
|
|
};
|
|
};
|
|
};
|
|
}
|