2022-07-14 12:49:19 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2022-09-09 14:08:57 +00:00
|
|
|
, cmake
|
2024-10-04 16:56:33 +00:00
|
|
|
, buildGoModule
|
2022-07-14 12:49:19 +00:00
|
|
|
, makeWrapper
|
|
|
|
, fetchFromGitHub
|
|
|
|
, pythonPackages
|
|
|
|
, pkg-config
|
|
|
|
, systemd
|
|
|
|
, hostname
|
2023-02-02 18:25:31 +00:00
|
|
|
, withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd
|
2022-07-14 12:49:19 +00:00
|
|
|
, extraTags ? [ ]
|
2023-11-16 04:20:00 +00:00
|
|
|
, testers
|
|
|
|
, datadog-agent
|
2022-07-14 12:49:19 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
# keep this in sync with github.com/DataDog/agent-payload dependency
|
2023-11-16 04:20:00 +00:00
|
|
|
payloadVersion = "5.0.97";
|
2020-04-24 23:36:52 +00:00
|
|
|
python = pythonPackages.python;
|
|
|
|
owner = "DataDog";
|
|
|
|
repo = "datadog-agent";
|
2021-09-18 10:52:07 +00:00
|
|
|
goPackagePath = "github.com/${owner}/${repo}";
|
2024-02-07 01:22:34 +00:00
|
|
|
version = "7.50.3";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
inherit owner repo;
|
2021-09-18 10:52:07 +00:00
|
|
|
rev = version;
|
2024-02-07 01:22:34 +00:00
|
|
|
hash = "sha256-AN5BruLPyrpIGSUkcYkZC0VgItk9NHiZTXstv6j9TlY=";
|
2022-09-09 14:08:57 +00:00
|
|
|
};
|
|
|
|
rtloader = stdenv.mkDerivation {
|
|
|
|
pname = "datadog-agent-rtloader";
|
|
|
|
src = "${src}/rtloader";
|
|
|
|
inherit version;
|
|
|
|
nativeBuildInputs = [ cmake ];
|
|
|
|
buildInputs = [ python ];
|
|
|
|
cmakeFlags = ["-DBUILD_DEMO=OFF" "-DDISABLE_PYTHON2=ON"];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-10-04 16:56:33 +00:00
|
|
|
in buildGoModule rec {
|
2022-09-09 14:08:57 +00:00
|
|
|
pname = "datadog-agent";
|
|
|
|
inherit src version;
|
|
|
|
|
|
|
|
doCheck = false;
|
|
|
|
|
2024-02-07 01:22:34 +00:00
|
|
|
vendorHash = "sha256-Rn8EB/6FHQk9COlOaxm4TQXjGCIPZHJV2QQnPDcbRnM=";
|
2021-09-18 10:52:07 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
subPackages = [
|
|
|
|
"cmd/agent"
|
|
|
|
"cmd/cluster-agent"
|
|
|
|
"cmd/dogstatsd"
|
|
|
|
"cmd/py-launcher"
|
|
|
|
"cmd/trace-agent"
|
|
|
|
];
|
|
|
|
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
nativeBuildInputs = [ pkg-config makeWrapper ];
|
2022-09-09 14:08:57 +00:00
|
|
|
buildInputs = [rtloader] ++ lib.optionals withSystemd [ systemd ];
|
2020-04-24 23:36:52 +00:00
|
|
|
PKG_CONFIG_PATH = "${python}/lib/pkgconfig";
|
|
|
|
|
2022-07-14 12:49:19 +00:00
|
|
|
tags = [
|
|
|
|
"ec2"
|
2022-09-09 14:08:57 +00:00
|
|
|
"python"
|
2022-07-14 12:49:19 +00:00
|
|
|
"process"
|
|
|
|
"log"
|
|
|
|
"secrets"
|
2024-01-02 11:29:13 +00:00
|
|
|
"zlib"
|
2022-07-14 12:49:19 +00:00
|
|
|
]
|
|
|
|
++ lib.optionals withSystemd [ "systemd" ]
|
|
|
|
++ extraTags;
|
|
|
|
|
|
|
|
ldflags = [
|
|
|
|
"-X ${goPackagePath}/pkg/version.Commit=${src.rev}"
|
|
|
|
"-X ${goPackagePath}/pkg/version.AgentVersion=${version}"
|
|
|
|
"-X ${goPackagePath}/pkg/serializer.AgentPayloadVersion=${payloadVersion}"
|
2022-09-09 14:08:57 +00:00
|
|
|
"-X ${goPackagePath}/pkg/collector/python.pythonHome3=${python}"
|
|
|
|
"-X ${goPackagePath}/pkg/config.DefaultPython=3"
|
2022-07-14 12:49:19 +00:00
|
|
|
"-r ${python}/lib"
|
|
|
|
];
|
|
|
|
|
|
|
|
preBuild = ''
|
2021-09-18 10:52:07 +00:00
|
|
|
# Keep directories to generate in sync with tasks/go.py
|
|
|
|
go generate ./pkg/status ./cmd/agent/gui
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
# DataDog use paths relative to the agent binary, so fix these.
|
|
|
|
postPatch = ''
|
2020-05-15 21:57:56 +00:00
|
|
|
sed -e "s|PyChecksPath =.*|PyChecksPath = \"$out/${python.sitePackages}\"|" \
|
|
|
|
-e "s|distPath =.*|distPath = \"$out/share/datadog-agent\"|" \
|
2023-11-16 04:20:00 +00:00
|
|
|
-i cmd/agent/common/path/path_nix.go
|
2020-04-24 23:36:52 +00:00
|
|
|
sed -e "s|/bin/hostname|${lib.getBin hostname}/bin/hostname|" \
|
2023-11-16 04:20:00 +00:00
|
|
|
-i pkg/util/hostname/fqdn_nix.go
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
# Install the config files and python modules from the "dist" dir
|
|
|
|
# into standard paths.
|
|
|
|
postInstall = ''
|
2020-05-15 21:57:56 +00:00
|
|
|
mkdir -p $out/${python.sitePackages} $out/share/datadog-agent
|
2023-07-15 17:15:38 +00:00
|
|
|
cp -R --no-preserve=mode $src/cmd/agent/dist/conf.d $out/share/datadog-agent
|
|
|
|
rm -rf $out/share/datadog-agent/conf.d/{apm.yaml.default,process_agent.yaml.default,winproc.d}
|
2020-05-15 21:57:56 +00:00
|
|
|
cp -R $src/cmd/agent/dist/{checks,utils,config.py} $out/${python.sitePackages}
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
cp -R $src/pkg/status/templates $out/share/datadog-agent
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-05-15 21:57:56 +00:00
|
|
|
wrapProgram "$out/bin/agent" \
|
2022-07-14 12:49:19 +00:00
|
|
|
--set PYTHONPATH "$out/${python.sitePackages}"'' + lib.optionalString withSystemd '' \
|
2022-12-17 10:02:37 +00:00
|
|
|
--prefix LD_LIBRARY_PATH : '' + lib.makeLibraryPath [ (lib.getLib systemd) rtloader ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
passthru.tests.version = testers.testVersion {
|
|
|
|
package = datadog-agent;
|
|
|
|
command = "agent version";
|
|
|
|
};
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = ''
|
|
|
|
Event collector for the DataDog analysis service
|
|
|
|
-- v6 new golang implementation.
|
|
|
|
'';
|
|
|
|
homepage = "https://www.datadoghq.com";
|
|
|
|
license = licenses.bsd3;
|
2024-01-02 11:29:13 +00:00
|
|
|
maintainers = with maintainers; [ thoughtpolice domenkozar ];
|
2022-12-17 10:02:37 +00:00
|
|
|
# never built on aarch64-darwin since first introduction in nixpkgs
|
2024-09-26 11:04:55 +00:00
|
|
|
broken = stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|