depot/third_party/nixpkgs/pkgs/tools/misc/opentelemetry-collector/builder.nix

47 lines
1.3 KiB
Nix

{
lib,
buildGoModule,
fetchFromGitHub,
}:
buildGoModule rec {
pname = "ocb";
# Also update `pkgs/tools/misc/opentelemetry-collector/releases.nix`
# whenever that version changes.
version = "0.114.0";
src = fetchFromGitHub {
owner = "open-telemetry";
repo = "opentelemetry-collector";
rev = "cmd/builder/v${version}";
hash = "sha256-zy+TWjh7janUhpxO9fOC8C9vz/tI0mbAyEsCo9zZ1j4=";
};
sourceRoot = "${src.name}/cmd/builder";
vendorHash = "sha256-dLNs9Vgn6f10hl5XuPzzE4eFNfvELWSKGsd7FbSiHkU=";
CGO_ENABLED = 0;
ldflags = [
"-s"
"-w"
"-X go.opentelemetry.io/collector/cmd/builder/internal.version=${version}"
];
# Some tests download new dependencies for a modified go.mod. Nix doesn't allow network access so skipping.
checkFlags = [
"-skip TestGenerateAndCompile|TestReplaceStatementsAreComplete|TestVersioning"
];
# Rename to ocb (it's generated as "builder")
postInstall = ''
mv $out/bin/builder $out/bin/ocb
'';
meta = {
description = "OpenTelemetry Collector";
homepage = "https://github.com/open-telemetry/opentelemetry-collector.git";
changelog = "https://github.com/open-telemetry/opentelemetry-collector/blob/${src.rev}/CHANGELOG.md";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ davsanchez ];
mainProgram = "ocb";
};
}