victoriametrics: use replace-fail, finalAttr, remove with lib;

This commit is contained in:
Shawn8901
2025-03-28 20:44:55 +01:00
parent e2d0076267
commit 52e3404fdc
+12 -12
View File
@@ -12,14 +12,14 @@
withVictoriaLogs ? true, # logs server
}:
buildGoModule rec {
buildGoModule (finalAttrs: {
pname = "VictoriaMetrics";
version = "1.113.0";
src = fetchFromGitHub {
owner = "VictoriaMetrics";
repo = "VictoriaMetrics";
tag = "v${version}";
tag = "v${finalAttrs.version}";
hash = "sha256-yjK81kT2EW8Vqykl2xelCQg54ancVfSHriG08z7tXWU=";
};
@@ -60,20 +60,20 @@ buildGoModule rec {
# Increase timeouts in tests to prevent failure on heavily loaded builders
substituteInPlace lib/storage/storage_test.go \
--replace "time.After(10 " "time.After(120 " \
--replace "time.NewTimer(30 " "time.NewTimer(120 " \
--replace "time.NewTimer(time.Second * 10)" "time.NewTimer(time.Second * 120)" \
--replace-fail "time.After(10 " "time.After(120 " \
--replace-fail "time.NewTimer(30 " "time.NewTimer(120 " \
--replace-fail "time.NewTimer(time.Second * 10)" "time.NewTimer(time.Second * 120)" \
'';
ldflags = [
"-s"
"-w"
"-X github.com/VictoriaMetrics/VictoriaMetrics/lib/buildinfo.Version=${version}"
"-X github.com/VictoriaMetrics/VictoriaMetrics/lib/buildinfo.Version=${finalAttrs.version}"
];
preCheck = ''
# `lib/querytracer/tracer_test.go` expects `buildinfo.Version` to be unset
export ldflags=''${ldflags//=${version}/=}
export ldflags=''${ldflags//=${finalAttrs.version}/=}
'';
__darwinAllowLocalNetworking = true;
@@ -82,18 +82,18 @@ buildGoModule rec {
inherit (nixosTests) victoriametrics;
};
meta = with lib; {
meta = {
homepage = "https://victoriametrics.com/";
description = "fast, cost-effective and scalable time series database, long-term remote storage for Prometheus";
license = licenses.asl20;
maintainers = with maintainers; [
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [
yorickvp
ivan
leona
shawn8901
ryan4yin
];
changelog = "https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v${version}";
changelog = "https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v${finalAttrs.version}";
mainProgram = "victoria-metrics";
};
}
})