Done with the help of https://github.com/Mindavi/nixpkgs-mark-broken Tool is still WIP but this is one of the first results. I manually audited the results and removed some results that were not valid. Note that some of these packages maybe should have more constrained platforms set instead of broken set, but I think not being perfectly correct is better than just keep trying to build all these things and never succeeding. Some observations: - Some darwin builds require XCode tools - aarch64-linux builds sometimes suffer from using gcc9 - gcc9 is getting older and misses some new libraries/features - Sometimes tools try to do system detection or expect some explicit settings for platforms that are not x86_64-linux
117 lines
3.3 KiB
Nix
117 lines
3.3 KiB
Nix
{ lib
|
|
, stdenv
|
|
, cmake
|
|
, buildGo118Module
|
|
, makeWrapper
|
|
, fetchFromGitHub
|
|
, pythonPackages
|
|
, pkg-config
|
|
, systemd
|
|
, hostname
|
|
, withSystemd ? stdenv.isLinux
|
|
, extraTags ? [ ]
|
|
}:
|
|
|
|
let
|
|
# keep this in sync with github.com/DataDog/agent-payload dependency
|
|
payloadVersion = "4.78.0";
|
|
python = pythonPackages.python;
|
|
owner = "DataDog";
|
|
repo = "datadog-agent";
|
|
goPackagePath = "github.com/${owner}/${repo}";
|
|
version = "7.38.1";
|
|
|
|
src = fetchFromGitHub {
|
|
inherit owner repo;
|
|
rev = version;
|
|
sha256 = "sha256-bG8wsSQvZcG4/Th6mWVdVX9vpeYBZx8FxwdYXpIdXnU=";
|
|
};
|
|
rtloader = stdenv.mkDerivation {
|
|
pname = "datadog-agent-rtloader";
|
|
src = "${src}/rtloader";
|
|
inherit version;
|
|
nativeBuildInputs = [ cmake ];
|
|
buildInputs = [ python ];
|
|
cmakeFlags = ["-DBUILD_DEMO=OFF" "-DDISABLE_PYTHON2=ON"];
|
|
};
|
|
|
|
in buildGo118Module rec {
|
|
pname = "datadog-agent";
|
|
inherit src version;
|
|
|
|
doCheck = false;
|
|
|
|
vendorSha256 = "sha256-bGDf48wFa32hURZfGN5pCMmslC3PeLNayKcl5cfjq9M=";
|
|
|
|
subPackages = [
|
|
"cmd/agent"
|
|
"cmd/cluster-agent"
|
|
"cmd/dogstatsd"
|
|
"cmd/py-launcher"
|
|
"cmd/trace-agent"
|
|
];
|
|
|
|
|
|
nativeBuildInputs = [ pkg-config makeWrapper ];
|
|
buildInputs = [rtloader] ++ lib.optionals withSystemd [ systemd ];
|
|
PKG_CONFIG_PATH = "${python}/lib/pkgconfig";
|
|
|
|
tags = [
|
|
"ec2"
|
|
"python"
|
|
"process"
|
|
"log"
|
|
"secrets"
|
|
]
|
|
++ 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}"
|
|
"-X ${goPackagePath}/pkg/collector/python.pythonHome3=${python}"
|
|
"-X ${goPackagePath}/pkg/config.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.
|
|
postPatch = ''
|
|
sed -e "s|PyChecksPath =.*|PyChecksPath = \"$out/${python.sitePackages}\"|" \
|
|
-e "s|distPath =.*|distPath = \"$out/share/datadog-agent\"|" \
|
|
-i cmd/agent/common/common_nix.go
|
|
sed -e "s|/bin/hostname|${lib.getBin hostname}/bin/hostname|" \
|
|
-i pkg/util/hostname_nix.go
|
|
'';
|
|
|
|
# Install the config files and python modules from the "dist" dir
|
|
# into standard paths.
|
|
postInstall = ''
|
|
mkdir -p $out/${python.sitePackages} $out/share/datadog-agent
|
|
cp -R $src/cmd/agent/dist/conf.d $out/share/datadog-agent
|
|
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 ];
|
|
|
|
meta = with lib; {
|
|
description = ''
|
|
Event collector for the DataDog analysis service
|
|
-- v6 new golang implementation.
|
|
'';
|
|
homepage = "https://www.datadoghq.com";
|
|
license = licenses.bsd3;
|
|
maintainers = with maintainers; [ thoughtpolice domenkozar rvl viraptor ];
|
|
# never built on aarch64-darwin since first introduction in nixpkgs
|
|
broken = stdenv.isDarwin && stdenv.isAarch64;
|
|
};
|
|
}
|