depot/third_party/nixpkgs/nixos/modules/services/monitoring/todesk.nix
Default email 159e378cbb Project import generated by Copybara.
GitOrigin-RevId: c04d5652cfa9742b1d519688f65d1bbccea9eb7e
2024-09-19 17:19:46 +03:00

45 lines
1.1 KiB
Nix

{
config,
lib,
pkgs,
...
}:
let
cfg = config.services.todesk;
in
{
options = {
services.todesk.enable = lib.mkEnableOption "ToDesk daemon";
services.todesk.package = lib.mkPackageOption pkgs "todesk" { };
};
config = lib.mkIf cfg.enable {
environment.systemPackages = [ cfg.package ];
systemd.services.todeskd = {
description = "ToDesk Daemon Service";
wantedBy = [ "multi-user.target" ];
wants = [
"network-online.target"
"display-manager.service"
"nss-lookup.target"
];
serviceConfig = {
Type = "simple";
ExecStart = "${cfg.package}/bin/todesk service";
ExecReload = "${pkgs.coreutils}/bin/kill -SIGINT $MAINPID";
Restart = "on-failure";
WorkingDirectory = "/var/lib/todesk";
PrivateTmp = true;
StateDirectory = "todesk";
StateDirectoryMode = "0777"; # Desktop application read and write /opt/todesk/config/config.ini. Such a pain!
ProtectSystem = "strict";
ProtectHome = "read-only";
RemoveIPC = "yes";
};
};
};
}