11{ lib
22, stdenv
33, cmake
4- , buildGoModule
4+ , buildGo122Module
55, makeWrapper
66, fetchFromGitHub
77, pythonPackages
88, pkg-config
99, systemd
1010, hostname
1111, withSystemd ? lib . meta . availableOn stdenv . hostPlatform systemd
12+ , withDocker ? true
1213, extraTags ? [ ]
1314, testers
1415, datadog-agent
1516} :
1617
1718let
1819 # keep this in sync with github.com/DataDog/agent-payload dependency
19- payloadVersion = "5.0.97 " ;
20+ payloadVersion = "5.0.124 " ;
2021 python = pythonPackages . python ;
2122 owner = "DataDog" ;
2223 repo = "datadog-agent" ;
2324 goPackagePath = "github.com/${ owner } /${ repo } " ;
24- version = "7.50.3 " ;
25+ version = "7.56.2 " ;
2526
2627 src = fetchFromGitHub {
2728 inherit owner repo ;
2829 rev = version ;
29- hash = "sha256-AN5BruLPyrpIGSUkcYkZC0VgItk9NHiZTXstv6j9TlY =" ;
30+ hash = "sha256-rU3eg92MuGs/6r7oJho2roeUCZoyfqYt1xOERoRPqmQ =" ;
3031 } ;
3132 rtloader = stdenv . mkDerivation {
3233 pname = "datadog-agent-rtloader" ;
3738 cmakeFlags = [ "-DBUILD_DEMO=OFF" "-DDISABLE_PYTHON2=ON" ] ;
3839 } ;
3940
40- in buildGoModule rec {
41+ in buildGo122Module rec {
4142 pname = "datadog-agent" ;
4243 inherit src version ;
4344
4445 doCheck = false ;
4546
46- vendorHash = "sha256-Rn8EB/6FHQk9COlOaxm4TQXjGCIPZHJV2QQnPDcbRnM=" ;
47+ vendorHash = if stdenv . isDarwin
48+ then "sha256-3Piq5DPMTZUEjqNkw5HZY25An2kATX6Jac9unQfZnZc="
49+ else "sha256-FR0Et3DvjJhbYUPy9mpN0QCJ7QDU4VRZFUTL0J1FSXw=" ;
4750
4851 subPackages = [
4952 "cmd/agent"
5053 "cmd/cluster-agent"
5154 "cmd/dogstatsd"
52- "cmd/py-launcher"
5355 "cmd/trace-agent"
5456 ] ;
5557
@@ -67,26 +69,25 @@ in buildGoModule rec {
6769 "zlib"
6870 ]
6971 ++ lib . optionals withSystemd [ "systemd" ]
72+ ++ lib . optionals withDocker [ "docker" ]
7073 ++ extraTags ;
7174
7275 ldflags = [
7376 "-X ${ goPackagePath } /pkg/version.Commit=${ src . rev } "
7477 "-X ${ goPackagePath } /pkg/version.AgentVersion=${ version } "
7578 "-X ${ goPackagePath } /pkg/serializer.AgentPayloadVersion=${ payloadVersion } "
7679 "-X ${ goPackagePath } /pkg/collector/python.pythonHome3=${ python } "
77- "-X ${ goPackagePath } /pkg/config.DefaultPython=3"
80+ "-X ${ goPackagePath } /pkg/config/setup .DefaultPython=3"
7881 "-r ${ python } /lib"
7982 ] ;
8083
81- preBuild = ''
82- # Keep directories to generate in sync with tasks/go.py
83- go generate ./pkg/status ./cmd/agent/gui
84- '' ;
85-
8684 # DataDog use paths relative to the agent binary, so fix these.
85+ # We can't just point these to $out since that would introduce self-referential paths in the go modules,
86+ # which are a fixed-output derivation. However, the patches aren't picked up if we skip them when building
87+ # the modules. So we'll just traverse from the bin back to the out folder.
8788 postPatch = ''
88- sed -e "s|PyChecksPath =.*|PyChecksPath = \"$out/ $ {python . sitePackages } \"|" \
89- -e "s|distPath =.*|distPath = \"$out/ share/ datadog-agent\"|" \
89+ sed -e "s|PyChecksPath =.*|PyChecksPath = filepath.Join(_here, \"..\", \" $ {python . sitePackages } \") |" \
90+ -e "s|distPath =.*|distPath = filepath.Join(_here, \"..\", \" share\", \" datadog-agent\") |" \
9091 -i cmd/agent/common/path/path_nix.go
9192 sed -e "s|/bin/hostname|${ lib . getBin hostname } /bin/hostname|" \
9293 -i pkg/util/hostname/fqdn_nix.go
@@ -97,11 +98,9 @@ in buildGoModule rec {
9798 postInstall = ''
9899 mkdir -p $out/${ python . sitePackages } $out/share/datadog-agent
99100 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+ rm -rf $out/share/datadog-agent/conf.d/{apm.yaml.default,process_agent.yaml.default,winproc.d,agentcrashdetect.d,myapp.d }
101102 cp -R $src/cmd/agent/dist/{checks,utils,config.py} $out/${ python . sitePackages }
102103
103- cp -R $src/pkg/status/templates $out/share/datadog-agent
104-
105104 wrapProgram "$out/bin/agent" \
106105 --set PYTHONPATH "$out/${ python . sitePackages } "''
107106 + lib . optionalString withSystemd " --prefix LD_LIBRARY_PATH : ${ lib . makeLibraryPath [ ( lib . getLib systemd ) rtloader ] } " ;
@@ -119,10 +118,5 @@ in buildGoModule rec {
119118 homepage = "https://www.datadoghq.com" ;
120119 license = licenses . bsd3 ;
121120 maintainers = with maintainers ; [ thoughtpolice domenkozar ] ;
122- # never built on aarch64-darwin since first introduction in nixpkgs
123- # broken = stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64;
124-
125- # Upstream does not support Go > 1.21; for update refer to https://github.com/NixOS/nixpkgs/issues/351119
126- broken = true ;
127121 } ;
128122}
0 commit comments