1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
{
lib,
buildGoModule,
fetchFromGitHub,
nixosTests,
withServer ? true, # the actual metrics server
withVmAgent ? true, # Agent to collect metrics
withVmAlert ? true, # Alert Manager
withVmAuth ? true, # HTTP proxy for authentication
withBackupTools ? true, # vmbackup, vmrestore
withVmctl ? true, # vmctl is used to migrate time series
withVictoriaLogs ? true, # logs server
}:
buildGoModule rec {
pname = "VictoriaMetrics";
version = "1.101.0";
src = fetchFromGitHub {
owner = "VictoriaMetrics";
repo = "VictoriaMetrics";
rev = "v${version}";
hash = "sha256-Jjz/CbVCvc9NFbvzYTFthG8cov4pYpc6y1A1Kmd3Mjg=";
};
vendorHash = null;
subPackages =
lib.optionals withServer [
"app/victoria-metrics"
"app/vminsert"
"app/vmselect"
"app/vmstorage"
"app/vmui"
]
++ lib.optionals withVmAgent [ "app/vmagent" ]
++ lib.optionals withVmAlert [
"app/vmalert"
"app/vmalert-tool"
]
++ lib.optionals withVmAuth [ "app/vmauth" ]
++ lib.optionals withVmctl [ "app/vmctl" ]
++ lib.optionals withBackupTools [
"app/vmbackup"
"app/vmrestore"
]
++ lib.optionals withVictoriaLogs [
"app/victoria-logs"
"app/vlinsert"
"app/vlselect"
"app/vlstorage"
];
postPatch = ''
# main module (github.com/VictoriaMetrics/VictoriaMetrics) does not contain package
# github.com/VictoriaMetrics/VictoriaMetrics/app/vmui/packages/vmui/web
#
# This appears to be some kind of test server for development purposes only.
rm -f app/vmui/packages/vmui/web/{go.mod,main.go}
# 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)" \
'';
ldflags = [
"-s"
"-w"
"-X github.com/VictoriaMetrics/VictoriaMetrics/lib/buildinfo.Version=${version}"
];
preCheck = ''
# `lib/querytracer/tracer_test.go` expects `buildinfo.Version` to be unset
export ldflags=''${ldflags//=${version}/=}
'';
__darwinAllowLocalNetworking = true;
passthru.tests = {
inherit (nixosTests) victoriametrics;
};
meta = with lib; {
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; [
yorickvp
ivan
leona
shawn8901
];
changelog = "https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v${version}";
mainProgram = "victoria-metrics";
};
}
|