anchor.diff:    };
   
     config = mkIf cfg.enable {
  -    environment.etc = [ { source = datadog-conf; target = "dd-agent/datadog.conf"; } ];
  -    environment.systemPackages = [ pkgs."dd-agent" ];
  +    environment.etc = [ { source = datadog_conf; target = "dd-agent/datadog.conf"; } ];
  +    environment.systemPackages = [ pkgs."dd-agent" pkgs.sysstat pkgs.procps ];
   
       users.extraUsers."dd-agent" = {
         description = "Datadog Agent User";
  
positive.code: let
    cfg = config.services.dd-agent;
  
    datadog-conf = pkgs.runCommand "datadog.conf" {} ''
      sed -e 's|^api_key:|api_key: ${cfg.api_key}|' ${optionalString (cfg.hostname != null)
        "-e 's|^#hostname: mymachine.mydomain|hostname: ${cfg.hostname}|'"
      } ${pkgs.dd-agent}/etc/dd-agent/datadog.conf.example > $out
  
negative.code: 
      systemd.services.dd-agent = {
        description = "Datadog agent monitor";
        path = [ pkgs."dd-agent" pkgs.python pkgs.sysstat pkgs.procps];
        wantedBy = [ "multi-user.target" ];
        serviceConfig = {
          ExecStart = "${pkgs.dd-agent}/bin/dd-agent foreground";
          User = "dd-agent";
          Group = "dd-agent";
        };
        restartTriggers = [ pkgs.dd-agent datadog_conf ];
      };
  
      systemd.services.dogstatsd = {
        description = "Datadog statsd";
        path = [ pkgs."dd-agent" pkgs.python ];
        wantedBy = [ "multi-user.target" ];
        serviceConfig = {
          ExecStart = "${pkgs.dd-agent}/bin/dogstatsd start";
          User = "dd-agent";
          Group = "dd-agent";
          Type = "forking";
          PIDFile = "/tmp/dogstatsd.pid";
        };
        restartTriggers = [ pkgs.dd-agent datadog_conf ];
      };
    };
  }
  