nixos/do-agent: use .service from upstream

This commit is contained in:
Peter Hoeg 2020-07-23 19:22:27 +08:00
parent 961cc80742
commit e0589ec65b

View file

@ -4,6 +4,7 @@ with lib;
let
cfg = config.services.do-agent;
in
{
options.services.do-agent = {
@ -11,23 +12,13 @@ in
};
config = mkIf cfg.enable {
environment.systemPackages = [ pkgs.do-agent ];
systemd.packages = [ pkgs.do-agent ];
systemd.services.do-agent = {
description = "DigitalOcean Droplet Metrics Agent";
wantedBy = [ "multi-user.target" ];
after = [ "network-online.target" ];
wants = [ "network-online.target" ];
serviceConfig = {
ExecStart = "${pkgs.do-agent}/bin/do-agent --syslog";
Restart = "always";
OOMScoreAdjust = -900;
SyslogIdentifier = "DigitalOceanAgent";
PrivateTmp = "yes";
ProtectSystem = "full";
ProtectHome = "yes";
NoNewPrivileges = "yes";
DynamicUser = "yes";
ExecStart = [ "" "${pkgs.do-agent}/bin/do-agent --syslog" ];
DynamicUser = true;
};
};
};