2018-09-08 23:39:55 +02:00
|
|
|
{ stdenv, fetchFromGitHub, buildGoPackage, makeWrapper, pythonPackages, pkgconfig, systemd }:
|
2018-05-05 13:44:36 +02:00
|
|
|
|
|
|
|
let
|
|
|
|
# keep this in sync with github.com/DataDog/agent-payload dependency
|
2018-09-08 23:39:55 +02:00
|
|
|
payloadVersion = "4.7.1";
|
2018-05-05 13:44:36 +02:00
|
|
|
|
|
|
|
in buildGoPackage rec {
|
|
|
|
name = "datadog-agent-${version}";
|
2018-12-24 12:16:22 +01:00
|
|
|
version = "6.8.3";
|
2018-05-05 13:44:36 +02:00
|
|
|
owner = "DataDog";
|
|
|
|
repo = "datadog-agent";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
inherit owner repo;
|
2018-12-24 12:16:22 +01:00
|
|
|
rev = "${version}";
|
|
|
|
sha256 = "18kk3f10pbcxplshxzbblga6bqlkk5mgy536yy27j463l4xps92q";
|
2018-05-05 13:44:36 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
subPackages = [
|
|
|
|
"cmd/agent"
|
|
|
|
"cmd/dogstatsd"
|
|
|
|
"cmd/py-launcher"
|
2018-09-08 23:39:55 +02:00
|
|
|
# Does not compile: go/src/github.com/DataDog/datadog-agent/cmd/cluster-agent/main.go:31:12: undefined: app.ClusterAgentCmd
|
|
|
|
#"cmd/cluster-agent"
|
2018-05-05 13:44:36 +02:00
|
|
|
];
|
|
|
|
goDeps = ./deps.nix;
|
|
|
|
goPackagePath = "github.com/${owner}/${repo}";
|
|
|
|
|
2018-08-09 15:33:22 +02:00
|
|
|
# Explicitly set this here to allow it to be overridden.
|
|
|
|
python = pythonPackages.python;
|
|
|
|
|
2018-05-05 13:44:36 +02:00
|
|
|
nativeBuildInputs = [ pkgconfig makeWrapper ];
|
2018-09-08 23:39:55 +02:00
|
|
|
buildInputs = [ systemd ];
|
2018-05-05 13:44:36 +02:00
|
|
|
PKG_CONFIG_PATH = "${python}/lib/pkgconfig";
|
|
|
|
|
2018-09-08 23:39:55 +02:00
|
|
|
|
|
|
|
preBuild = let
|
2018-05-05 13:44:36 +02:00
|
|
|
ldFlags = stdenv.lib.concatStringsSep " " [
|
|
|
|
"-X ${goPackagePath}/pkg/version.Commit=${src.rev}"
|
|
|
|
"-X ${goPackagePath}/pkg/version.AgentVersion=${version}"
|
|
|
|
"-X ${goPackagePath}/pkg/serializer.AgentPayloadVersion=${payloadVersion}"
|
|
|
|
"-X ${goPackagePath}/pkg/collector/py.pythonHome=${python}"
|
|
|
|
"-r ${python}/lib"
|
|
|
|
];
|
2018-09-08 23:39:55 +02:00
|
|
|
in ''
|
|
|
|
buildFlagsArray=( "-tags" "ec2 systemd cpython process log" "-ldflags" "${ldFlags}")
|
|
|
|
'';
|
2018-05-05 13:44:36 +02:00
|
|
|
|
|
|
|
# DataDog use paths relative to the agent binary, so fix these.
|
|
|
|
postPatch = ''
|
|
|
|
sed -e "s|PyChecksPath =.*|PyChecksPath = \"$bin/${python.sitePackages}\"|" \
|
|
|
|
-e "s|distPath =.*|distPath = \"$bin/share/datadog-agent\"|" \
|
|
|
|
-i cmd/agent/common/common_nix.go
|
|
|
|
'';
|
|
|
|
|
|
|
|
# Install the config files and python modules from the "dist" dir
|
|
|
|
# into standard paths.
|
|
|
|
postInstall = ''
|
|
|
|
mkdir -p $bin/${python.sitePackages} $bin/share/datadog-agent
|
2018-12-24 12:16:22 +01:00
|
|
|
cp -R $src/cmd/agent/dist/conf.d $bin/share/datadog-agent
|
2018-05-05 13:44:36 +02:00
|
|
|
cp -R $src/cmd/agent/dist/{checks,utils,config.py} $bin/${python.sitePackages}
|
|
|
|
|
|
|
|
cp -R $src/pkg/status/dist/templates $bin/share/datadog-agent
|
|
|
|
|
|
|
|
wrapProgram "$bin/bin/agent" \
|
2018-09-13 10:11:41 +02:00
|
|
|
--set PYTHONPATH "$bin/${python.sitePackages}" \
|
|
|
|
--prefix LD_LIBRARY_PATH : ${systemd.lib}/lib
|
2018-05-05 13:44:36 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = ''
|
|
|
|
Event collector for the DataDog analysis service
|
|
|
|
-- v6 new golang implementation.
|
|
|
|
'';
|
|
|
|
homepage = https://www.datadoghq.com;
|
|
|
|
license = licenses.bsd3;
|
|
|
|
platforms = platforms.all;
|
|
|
|
maintainers = with maintainers; [ thoughtpolice domenkozar rvl ];
|
|
|
|
};
|
|
|
|
}
|