beats 7.x: refactor

Replace `recursiveUpdate` with `//` and explicit `meta`/`passthru`
merging so that `builtins.unsafeGetAttrPos` can find `meta.description`
at each call site, making the `pos = __curPos` workaround unnecessary.

Also adopt the `finalAttrs` pattern and use `tag` instead of `rev` in
`fetchFromGitHub`.
This commit is contained in:
Philip Taron
2026-02-16 11:29:58 -08:00
parent 210c67c26c
commit ae276351ab

View File

@@ -13,14 +13,15 @@ let
beat =
package: extraArgs:
buildGoModule (
lib.attrsets.recursiveUpdate rec {
finalAttrs:
{
pname = package;
version = elk7Version;
src = fetchFromGitHub {
owner = "elastic";
repo = "beats";
rev = "v${version}";
tag = "v${finalAttrs.version}";
hash = "sha256-TzcKB1hIHe1LNZ59GcvR527yvYqPKNXPIhpWH2vyMTY=";
};
@@ -36,17 +37,19 @@ let
dfithian
];
platforms = lib.platforms.linux;
};
} extraArgs
}
// (extraArgs.meta or { });
}
// removeAttrs extraArgs [
"meta"
]
);
in
rec {
auditbeat7 = beat "auditbeat" {
pos = __curPos;
meta.description = "Lightweight shipper for audit data";
};
filebeat7 = beat "filebeat" {
pos = __curPos;
meta.description = "Lightweight shipper for logfiles";
buildInputs = [ systemd ];
tags = [ "withjournald" ];
@@ -55,11 +58,9 @@ rec {
'';
};
heartbeat7 = beat "heartbeat" {
pos = __curPos;
meta.description = "Lightweight shipper for uptime monitoring";
};
metricbeat7 = beat "metricbeat" {
pos = __curPos;
meta.description = "Lightweight shipper for metrics";
passthru.tests = lib.optionalAttrs config.allowUnfree (
assert metricbeat7.drvPath == nixosTests.elk.unfree.ELK-7.elkPackages.metricbeat.drvPath;
@@ -70,7 +71,6 @@ rec {
};
packetbeat7 = beat "packetbeat" {
buildInputs = [ libpcap ];
pos = __curPos;
meta.description = "Network packet analyzer that ships data to Elasticsearch";
meta.longDescription = ''
Packetbeat is an open source network packet analyzer that ships the