summaryrefslogtreecommitdiffstats
path: root/nixos/modules/services/monitoring/do-agent.nix
blob: 23595ac00c323403d5826e05d949a6cc0a828e35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{
  config,
  lib,
  pkgs,
  ...
}:
let
  cfg = config.services.do-agent;

in
{
  options.services.do-agent = {
    enable = lib.mkEnableOption "do-agent, the DigitalOcean droplet metrics agent";
  };

  config = lib.mkIf cfg.enable {
    systemd.packages = [ pkgs.do-agent ];

    systemd.services.do-agent = {
      wantedBy = [ "multi-user.target" ];
      serviceConfig = {
        ExecStart = [
          ""
          "${pkgs.do-agent}/bin/do-agent --syslog"
        ];
        DynamicUser = true;
      };
    };
  };
}