Merge pull request #168453 from viraptor/viraptor/datadog-without-systemd
This commit is contained in:
commit
9b08b9c44f
|
@ -1,4 +1,15 @@
|
||||||
{ lib, buildGoModule, makeWrapper, fetchFromGitHub, pythonPackages, pkg-config, systemd, hostname, extraTags ? [] }:
|
{ lib
|
||||||
|
, stdenv
|
||||||
|
, buildGoModule
|
||||||
|
, makeWrapper
|
||||||
|
, fetchFromGitHub
|
||||||
|
, pythonPackages
|
||||||
|
, pkg-config
|
||||||
|
, systemd
|
||||||
|
, hostname
|
||||||
|
, withSystemd ? stdenv.isLinux
|
||||||
|
, extraTags ? [ ]
|
||||||
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
# keep this in sync with github.com/DataDog/agent-payload dependency
|
# keep this in sync with github.com/DataDog/agent-payload dependency
|
||||||
|
@ -30,19 +41,28 @@ in buildGoModule rec {
|
||||||
|
|
||||||
|
|
||||||
nativeBuildInputs = [ pkg-config makeWrapper ];
|
nativeBuildInputs = [ pkg-config makeWrapper ];
|
||||||
buildInputs = [ systemd ];
|
buildInputs = lib.optionals withSystemd [ systemd ];
|
||||||
PKG_CONFIG_PATH = "${python}/lib/pkgconfig";
|
PKG_CONFIG_PATH = "${python}/lib/pkgconfig";
|
||||||
|
|
||||||
preBuild = let
|
tags = [
|
||||||
ldFlags = lib.concatStringsSep " " [
|
"ec2"
|
||||||
"-X ${goPackagePath}/pkg/version.Commit=${src.rev}"
|
"cpython"
|
||||||
"-X ${goPackagePath}/pkg/version.AgentVersion=${version}"
|
"process"
|
||||||
"-X ${goPackagePath}/pkg/serializer.AgentPayloadVersion=${payloadVersion}"
|
"log"
|
||||||
"-X ${goPackagePath}/pkg/collector/py.pythonHome=${python}"
|
"secrets"
|
||||||
"-r ${python}/lib"
|
]
|
||||||
];
|
++ lib.optionals withSystemd [ "systemd" ]
|
||||||
in ''
|
++ extraTags;
|
||||||
buildFlagsArray=( "-tags" "ec2 systemd cpython process log secrets ${lib.concatStringsSep " " extraTags}" "-ldflags" "${ldFlags}")
|
|
||||||
|
ldflags = [
|
||||||
|
"-X ${goPackagePath}/pkg/version.Commit=${src.rev}"
|
||||||
|
"-X ${goPackagePath}/pkg/version.AgentVersion=${version}"
|
||||||
|
"-X ${goPackagePath}/pkg/serializer.AgentPayloadVersion=${payloadVersion}"
|
||||||
|
"-X ${goPackagePath}/pkg/collector/py.pythonHome=${python}"
|
||||||
|
"-r ${python}/lib"
|
||||||
|
];
|
||||||
|
|
||||||
|
preBuild = ''
|
||||||
# Keep directories to generate in sync with tasks/go.py
|
# Keep directories to generate in sync with tasks/go.py
|
||||||
go generate ./pkg/status ./cmd/agent/gui
|
go generate ./pkg/status ./cmd/agent/gui
|
||||||
'';
|
'';
|
||||||
|
@ -66,7 +86,7 @@ in buildGoModule rec {
|
||||||
cp -R $src/pkg/status/templates $out/share/datadog-agent
|
cp -R $src/pkg/status/templates $out/share/datadog-agent
|
||||||
|
|
||||||
wrapProgram "$out/bin/agent" \
|
wrapProgram "$out/bin/agent" \
|
||||||
--set PYTHONPATH "$out/${python.sitePackages}" \
|
--set PYTHONPATH "$out/${python.sitePackages}"'' + lib.optionalString withSystemd '' \
|
||||||
--prefix LD_LIBRARY_PATH : ${lib.getLib systemd}/lib
|
--prefix LD_LIBRARY_PATH : ${lib.getLib systemd}/lib
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -77,6 +97,6 @@ in buildGoModule rec {
|
||||||
'';
|
'';
|
||||||
homepage = "https://www.datadoghq.com";
|
homepage = "https://www.datadoghq.com";
|
||||||
license = licenses.bsd3;
|
license = licenses.bsd3;
|
||||||
maintainers = with maintainers; [ thoughtpolice domenkozar rvl ];
|
maintainers = with maintainers; [ thoughtpolice domenkozar rvl viraptor ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue