evcc: 0.131.4 -> 0.131.5
[NixPkgs.git] / pkgs / by-name / vi / victoriametrics / package.nix
blob8f265415b300ecbd8e43286341c606ad96e5821d
2   lib,
3   buildGoModule,
4   fetchFromGitHub,
5   nixosTests,
6   withServer ? true, # the actual metrics server
7   withVmAgent ? true, # Agent to collect metrics
8   withVmAlert ? true, # Alert Manager
9   withVmAuth ? true, # HTTP proxy for authentication
10   withBackupTools ? true, # vmbackup, vmrestore
11   withVmctl ? true, # vmctl is used to migrate time series
12   withVictoriaLogs ? true, # logs server
15 buildGoModule rec {
16   pname = "VictoriaMetrics";
17   version = "1.105.0";
19   src = fetchFromGitHub {
20     owner = "VictoriaMetrics";
21     repo = "VictoriaMetrics";
22     rev = "v${version}";
23     hash = "sha256-cMc2CVjVTQLsY/GJht35DCapEtROPJO3j6FCCDXJPMk=";
24   };
26   vendorHash = null;
28   subPackages =
29     lib.optionals withServer [
30       "app/victoria-metrics"
31       "app/vminsert"
32       "app/vmselect"
33       "app/vmstorage"
34       "app/vmui"
35     ]
36     ++ lib.optionals withVmAgent [ "app/vmagent" ]
37     ++ lib.optionals withVmAlert [
38       "app/vmalert"
39       "app/vmalert-tool"
40     ]
41     ++ lib.optionals withVmAuth [ "app/vmauth" ]
42     ++ lib.optionals withVmctl [ "app/vmctl" ]
43     ++ lib.optionals withBackupTools [
44       "app/vmbackup"
45       "app/vmrestore"
46     ]
47     ++ lib.optionals withVictoriaLogs [
48       "app/victoria-logs"
49       "app/vlinsert"
50       "app/vlselect"
51       "app/vlstorage"
52     ];
54   postPatch = ''
55     # main module (github.com/VictoriaMetrics/VictoriaMetrics) does not contain package
56     # github.com/VictoriaMetrics/VictoriaMetrics/app/vmui/packages/vmui/web
57     #
58     # This appears to be some kind of test server for development purposes only.
59     rm -f app/vmui/packages/vmui/web/{go.mod,main.go}
61     # Increase timeouts in tests to prevent failure on heavily loaded builders
62     substituteInPlace lib/storage/storage_test.go \
63       --replace "time.After(10 " "time.After(120 " \
64       --replace "time.NewTimer(30 " "time.NewTimer(120 " \
65       --replace "time.NewTimer(time.Second * 10)" "time.NewTimer(time.Second * 120)" \
66   '';
68   ldflags = [
69     "-s"
70     "-w"
71     "-X github.com/VictoriaMetrics/VictoriaMetrics/lib/buildinfo.Version=${version}"
72   ];
74   preCheck = ''
75     # `lib/querytracer/tracer_test.go` expects `buildinfo.Version` to be unset
76     export ldflags=''${ldflags//=${version}/=}
77   '';
79   __darwinAllowLocalNetworking = true;
81   passthru.tests = {
82     inherit (nixosTests) victoriametrics;
83   };
85   meta = with lib; {
86     homepage = "https://victoriametrics.com/";
87     description = "fast, cost-effective and scalable time series database, long-term remote storage for Prometheus";
88     license = licenses.asl20;
89     maintainers = with maintainers; [
90       yorickvp
91       ivan
92       leona
93       shawn8901
94       ryan4yin
95     ];
96     changelog = "https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v${version}";
97     mainProgram = "victoria-metrics";
98   };