2022-04-28 01:01:27 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2022-08-08 14:09:47 +00:00
|
|
|
, cmake
|
2023-08-21 08:33:21 +00:00
|
|
|
, buildGoModule
|
2022-04-28 01:01:27 +00:00
|
|
|
, makeWrapper
|
|
|
|
, fetchFromGitHub
|
|
|
|
, pythonPackages
|
|
|
|
, pkg-config
|
|
|
|
, systemd
|
|
|
|
, hostname
|
2022-09-21 07:04:52 +00:00
|
|
|
, withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd
|
2022-04-28 01:01:27 +00:00
|
|
|
, extraTags ? [ ]
|
2023-10-24 15:03:29 +00:00
|
|
|
, testers
|
|
|
|
, datadog-agent
|
2022-04-28 01:01:27 +00:00
|
|
|
}:
|
2018-05-05 11:44:36 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
# keep this in sync with github.com/DataDog/agent-payload dependency
|
2023-10-24 15:03:29 +00:00
|
|
|
payloadVersion = "5.0.97";
|
2019-06-27 17:52:16 +00:00
|
|
|
python = pythonPackages.python;
|
2018-05-05 11:44:36 +00:00
|
|
|
owner = "DataDog";
|
|
|
|
repo = "datadog-agent";
|
2021-08-29 02:37:58 +00:00
|
|
|
goPackagePath = "github.com/${owner}/${repo}";
|
2023-11-17 09:04:23 +00:00
|
|
|
version = "7.49.0";
|
2018-05-05 11:44:36 +00:00
|
|
|
|
2021-09-07 23:19:17 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
inherit owner repo;
|
2021-08-29 02:37:58 +00:00
|
|
|
rev = version;
|
2023-11-17 09:04:23 +00:00
|
|
|
hash = "sha256-0/9Yngfnbq73ZWsHHF3yDNGBB+u4X9SKbv+lJdv0J/w=";
|
2018-05-05 11:44:36 +00:00
|
|
|
};
|
2022-08-08 14:09:47 +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"];
|
|
|
|
};
|
|
|
|
|
2023-08-21 08:33:21 +00:00
|
|
|
in buildGoModule rec {
|
2022-08-08 14:09:47 +00:00
|
|
|
pname = "datadog-agent";
|
|
|
|
inherit src version;
|
|
|
|
|
|
|
|
doCheck = false;
|
2018-05-05 11:44:36 +00:00
|
|
|
|
2023-11-17 09:04:23 +00:00
|
|
|
vendorHash = "sha256-oBqH5sbT1+dLnAfouh4Vyds3M5pw5Z7u8XGGBTXflS0=";
|
2021-08-29 02:37:58 +00:00
|
|
|
|
2018-05-05 11:44:36 +00:00
|
|
|
subPackages = [
|
|
|
|
"cmd/agent"
|
2019-03-01 07:21:10 +00:00
|
|
|
"cmd/cluster-agent"
|
2018-05-05 11:44:36 +00:00
|
|
|
"cmd/dogstatsd"
|
|
|
|
"cmd/py-launcher"
|
2019-03-01 07:21:10 +00:00
|
|
|
"cmd/trace-agent"
|
2018-05-05 11:44:36 +00:00
|
|
|
];
|
|
|
|
|
2018-08-09 13:33:22 +00:00
|
|
|
|
2021-09-07 23:19:17 +00:00
|
|
|
nativeBuildInputs = [ pkg-config makeWrapper ];
|
2022-08-08 14:09:47 +00:00
|
|
|
buildInputs = [rtloader] ++ lib.optionals withSystemd [ systemd ];
|
2018-05-05 11:44:36 +00:00
|
|
|
PKG_CONFIG_PATH = "${python}/lib/pkgconfig";
|
|
|
|
|
2022-04-28 01:01:27 +00:00
|
|
|
tags = [
|
|
|
|
"ec2"
|
2022-08-08 14:09:47 +00:00
|
|
|
"python"
|
2022-04-28 01:01:27 +00:00
|
|
|
"process"
|
|
|
|
"log"
|
|
|
|
"secrets"
|
2023-11-18 18:14:21 +00:00
|
|
|
"zlib"
|
2022-04-28 01:01:27 +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-08-08 14:09:47 +00:00
|
|
|
"-X ${goPackagePath}/pkg/collector/python.pythonHome3=${python}"
|
|
|
|
"-X ${goPackagePath}/pkg/config.DefaultPython=3"
|
2022-04-28 01:01:27 +00:00
|
|
|
"-r ${python}/lib"
|
|
|
|
];
|
|
|
|
|
|
|
|
preBuild = ''
|
2021-09-07 23:19:17 +00:00
|
|
|
# Keep directories to generate in sync with tasks/go.py
|
|
|
|
go generate ./pkg/status ./cmd/agent/gui
|
2018-09-08 21:39:55 +00:00
|
|
|
'';
|
2018-05-05 11:44:36 +00:00
|
|
|
|
|
|
|
# DataDog use paths relative to the agent binary, so fix these.
|
|
|
|
postPatch = ''
|
2020-04-28 01:50:57 +00:00
|
|
|
sed -e "s|PyChecksPath =.*|PyChecksPath = \"$out/${python.sitePackages}\"|" \
|
|
|
|
-e "s|distPath =.*|distPath = \"$out/share/datadog-agent\"|" \
|
2023-10-24 15:03:29 +00:00
|
|
|
-i cmd/agent/common/path/path_nix.go
|
2019-02-28 19:48:49 +00:00
|
|
|
sed -e "s|/bin/hostname|${lib.getBin hostname}/bin/hostname|" \
|
2023-10-24 15:03:29 +00:00
|
|
|
-i pkg/util/hostname/fqdn_nix.go
|
2018-05-05 11:44:36 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
# Install the config files and python modules from the "dist" dir
|
|
|
|
# into standard paths.
|
|
|
|
postInstall = ''
|
2020-04-28 01:50:57 +00:00
|
|
|
mkdir -p $out/${python.sitePackages} $out/share/datadog-agent
|
2022-09-04 08:09:32 +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-04-28 01:50:57 +00:00
|
|
|
cp -R $src/cmd/agent/dist/{checks,utils,config.py} $out/${python.sitePackages}
|
2018-05-05 11:44:36 +00:00
|
|
|
|
2021-08-29 02:37:58 +00:00
|
|
|
cp -R $src/pkg/status/templates $out/share/datadog-agent
|
2018-05-05 11:44:36 +00:00
|
|
|
|
2020-04-28 01:50:57 +00:00
|
|
|
wrapProgram "$out/bin/agent" \
|
2022-04-28 01:01:27 +00:00
|
|
|
--set PYTHONPATH "$out/${python.sitePackages}"'' + lib.optionalString withSystemd '' \
|
2022-12-07 12:06:54 +00:00
|
|
|
--prefix LD_LIBRARY_PATH : '' + lib.makeLibraryPath [ (lib.getLib systemd) rtloader ];
|
2018-05-05 11:44:36 +00:00
|
|
|
|
2023-10-24 15:03:29 +00:00
|
|
|
passthru.tests.version = testers.testVersion {
|
|
|
|
package = datadog-agent;
|
|
|
|
command = "agent version";
|
|
|
|
};
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2018-05-05 11:44:36 +00:00
|
|
|
description = ''
|
|
|
|
Event collector for the DataDog analysis service
|
|
|
|
-- v6 new golang implementation.
|
|
|
|
'';
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://www.datadoghq.com";
|
2018-05-05 11:44:36 +00:00
|
|
|
license = licenses.bsd3;
|
2023-12-09 09:54:03 +00:00
|
|
|
maintainers = with maintainers; [ thoughtpolice domenkozar viraptor ];
|
2022-12-06 20:47:40 +00:00
|
|
|
# never built on aarch64-darwin since first introduction in nixpkgs
|
|
|
|
broken = stdenv.isDarwin && stdenv.isAarch64;
|
2018-05-05 11:44:36 +00:00
|
|
|
};
|
|
|
|
}
|