11 , withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd
18 # keep this in sync with github.com/DataDog/agent-payload dependency
19 payloadVersion = "5.0.97";
20 python = pythonPackages.python;
22 repo = "datadog-agent";
23 goPackagePath = "github.com/${owner}/${repo}";
26 src = fetchFromGitHub {
29 hash = "sha256-AN5BruLPyrpIGSUkcYkZC0VgItk9NHiZTXstv6j9TlY=";
31 rtloader = stdenv.mkDerivation {
32 pname = "datadog-agent-rtloader";
33 src = "${src}/rtloader";
35 nativeBuildInputs = [ cmake ];
36 buildInputs = [ python ];
37 cmakeFlags = ["-DBUILD_DEMO=OFF" "-DDISABLE_PYTHON2=ON"];
40 in buildGoModule rec {
41 pname = "datadog-agent";
46 vendorHash = "sha256-Rn8EB/6FHQk9COlOaxm4TQXjGCIPZHJV2QQnPDcbRnM=";
57 nativeBuildInputs = [ pkg-config makeWrapper ];
58 buildInputs = [rtloader] ++ lib.optionals withSystemd [ systemd ];
59 PKG_CONFIG_PATH = "${python}/lib/pkgconfig";
69 ++ lib.optionals withSystemd [ "systemd" ]
73 "-X ${goPackagePath}/pkg/version.Commit=${src.rev}"
74 "-X ${goPackagePath}/pkg/version.AgentVersion=${version}"
75 "-X ${goPackagePath}/pkg/serializer.AgentPayloadVersion=${payloadVersion}"
76 "-X ${goPackagePath}/pkg/collector/python.pythonHome3=${python}"
77 "-X ${goPackagePath}/pkg/config.DefaultPython=3"
82 # Keep directories to generate in sync with tasks/go.py
83 go generate ./pkg/status ./cmd/agent/gui
86 # DataDog use paths relative to the agent binary, so fix these.
88 sed -e "s|PyChecksPath =.*|PyChecksPath = \"$out/${python.sitePackages}\"|" \
89 -e "s|distPath =.*|distPath = \"$out/share/datadog-agent\"|" \
90 -i cmd/agent/common/path/path_nix.go
91 sed -e "s|/bin/hostname|${lib.getBin hostname}/bin/hostname|" \
92 -i pkg/util/hostname/fqdn_nix.go
95 # Install the config files and python modules from the "dist" dir
96 # into standard paths.
98 mkdir -p $out/${python.sitePackages} $out/share/datadog-agent
99 cp -R --no-preserve=mode $src/cmd/agent/dist/conf.d $out/share/datadog-agent
100 rm -rf $out/share/datadog-agent/conf.d/{apm.yaml.default,process_agent.yaml.default,winproc.d}
101 cp -R $src/cmd/agent/dist/{checks,utils,config.py} $out/${python.sitePackages}
103 cp -R $src/pkg/status/templates $out/share/datadog-agent
105 wrapProgram "$out/bin/agent" \
106 --set PYTHONPATH "$out/${python.sitePackages}"'' + lib.optionalString withSystemd '' \
107 --prefix LD_LIBRARY_PATH : '' + lib.makeLibraryPath [ (lib.getLib systemd) rtloader ];
109 passthru.tests.version = testers.testVersion {
110 package = datadog-agent;
111 command = "agent version";
116 Event collector for the DataDog analysis service
117 -- v6 new golang implementation.
119 homepage = "https://www.datadoghq.com";
120 license = licenses.bsd3;
121 maintainers = with maintainers; [ thoughtpolice domenkozar ];
122 # never built on aarch64-darwin since first introduction in nixpkgs
123 broken = stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64;