From 5121d2de488bacefa7bdff9c2fb0e2e3633749c3 Mon Sep 17 00:00:00 2001 From: Mel Bourgeois Date: Mon, 25 Nov 2024 03:07:33 -0600 Subject: [PATCH] datadog-agent: 7.50.3 -> 7.56.2 --- .../networking/dd-agent/datadog-agent.nix | 40 ++++++++----------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/pkgs/tools/networking/dd-agent/datadog-agent.nix b/pkgs/tools/networking/dd-agent/datadog-agent.nix index 43da147e06ec..027986a408f4 100644 --- a/pkgs/tools/networking/dd-agent/datadog-agent.nix +++ b/pkgs/tools/networking/dd-agent/datadog-agent.nix @@ -1,7 +1,7 @@ { lib , stdenv , cmake -, buildGoModule +, buildGo122Module , makeWrapper , fetchFromGitHub , pythonPackages @@ -9,6 +9,7 @@ , systemd , hostname , withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd +, withDocker ? true , extraTags ? [ ] , testers , datadog-agent @@ -16,17 +17,17 @@ let # keep this in sync with github.com/DataDog/agent-payload dependency - payloadVersion = "5.0.97"; + payloadVersion = "5.0.124"; python = pythonPackages.python; owner = "DataDog"; repo = "datadog-agent"; goPackagePath = "github.com/${owner}/${repo}"; - version = "7.50.3"; + version = "7.56.2"; src = fetchFromGitHub { inherit owner repo; rev = version; - hash = "sha256-AN5BruLPyrpIGSUkcYkZC0VgItk9NHiZTXstv6j9TlY="; + hash = "sha256-rU3eg92MuGs/6r7oJho2roeUCZoyfqYt1xOERoRPqmQ="; }; rtloader = stdenv.mkDerivation { pname = "datadog-agent-rtloader"; @@ -37,19 +38,20 @@ let cmakeFlags = ["-DBUILD_DEMO=OFF" "-DDISABLE_PYTHON2=ON"]; }; -in buildGoModule rec { +in buildGo122Module rec { pname = "datadog-agent"; inherit src version; doCheck = false; - vendorHash = "sha256-Rn8EB/6FHQk9COlOaxm4TQXjGCIPZHJV2QQnPDcbRnM="; + vendorHash = if stdenv.isDarwin + then "sha256-3Piq5DPMTZUEjqNkw5HZY25An2kATX6Jac9unQfZnZc=" + else "sha256-FR0Et3DvjJhbYUPy9mpN0QCJ7QDU4VRZFUTL0J1FSXw="; subPackages = [ "cmd/agent" "cmd/cluster-agent" "cmd/dogstatsd" - "cmd/py-launcher" "cmd/trace-agent" ]; @@ -67,6 +69,7 @@ in buildGoModule rec { "zlib" ] ++ lib.optionals withSystemd [ "systemd" ] + ++ lib.optionals withDocker [ "docker" ] ++ extraTags; ldflags = [ @@ -74,19 +77,17 @@ in buildGoModule rec { "-X ${goPackagePath}/pkg/version.AgentVersion=${version}" "-X ${goPackagePath}/pkg/serializer.AgentPayloadVersion=${payloadVersion}" "-X ${goPackagePath}/pkg/collector/python.pythonHome3=${python}" - "-X ${goPackagePath}/pkg/config.DefaultPython=3" + "-X ${goPackagePath}/pkg/config/setup.DefaultPython=3" "-r ${python}/lib" ]; - preBuild = '' - # Keep directories to generate in sync with tasks/go.py - go generate ./pkg/status ./cmd/agent/gui - ''; - # DataDog use paths relative to the agent binary, so fix these. + # We can't just point these to $out since that would introduce self-referential paths in the go modules, + # which are a fixed-output derivation. However, the patches aren't picked up if we skip them when building + # the modules. So we'll just traverse from the bin back to the out folder. postPatch = '' - sed -e "s|PyChecksPath =.*|PyChecksPath = \"$out/${python.sitePackages}\"|" \ - -e "s|distPath =.*|distPath = \"$out/share/datadog-agent\"|" \ + sed -e "s|PyChecksPath =.*|PyChecksPath = filepath.Join(_here, \"..\", \"${python.sitePackages}\")|" \ + -e "s|distPath =.*|distPath = filepath.Join(_here, \"..\", \"share\", \"datadog-agent\")|" \ -i cmd/agent/common/path/path_nix.go sed -e "s|/bin/hostname|${lib.getBin hostname}/bin/hostname|" \ -i pkg/util/hostname/fqdn_nix.go @@ -97,11 +98,9 @@ in buildGoModule rec { postInstall = '' mkdir -p $out/${python.sitePackages} $out/share/datadog-agent 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} + rm -rf $out/share/datadog-agent/conf.d/{apm.yaml.default,process_agent.yaml.default,winproc.d,agentcrashdetect.d,myapp.d} cp -R $src/cmd/agent/dist/{checks,utils,config.py} $out/${python.sitePackages} - cp -R $src/pkg/status/templates $out/share/datadog-agent - wrapProgram "$out/bin/agent" \ --set PYTHONPATH "$out/${python.sitePackages}"'' + lib.optionalString withSystemd " --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ (lib.getLib systemd) rtloader ]}"; @@ -119,10 +118,5 @@ in buildGoModule rec { homepage = "https://www.datadoghq.com"; license = licenses.bsd3; maintainers = with maintainers; [ thoughtpolice domenkozar ]; - # never built on aarch64-darwin since first introduction in nixpkgs - # broken = stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64; - - # Upstream does not support Go > 1.21; for update refer to https://github.com/NixOS/nixpkgs/issues/351119 - broken = true; }; }