Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vmagent: build from victoriametrics derivation #308271

Merged
merged 3 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 55 additions & 24 deletions pkgs/by-name/vi/victoriametrics/package.nix
Original file line number Diff line number Diff line change
@@ -1,36 +1,55 @@
{ lib, buildGoModule, fetchFromGitHub, nixosTests }:
{
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 = pname;
repo = pname;
owner = "VictoriaMetrics";
repo = "VictoriaMetrics";
rev = "v${version}";
hash = "sha256-Jjz/CbVCvc9NFbvzYTFthG8cov4pYpc6y1A1Kmd3Mjg=";
};

vendorHash = null;

subPackages = [
"app/victoria-logs"
"app/victoria-metrics"
"app/vlinsert"
"app/vlselect"
"app/vlstorage"
"app/vmagent"
"app/vmalert-tool"
"app/vmalert"
"app/vmauth"
"app/vmctl"
"app/vminsert"
"app/vmselect"
"app/vmstorage"
"app/vmbackup"
"app/vmrestore"
"app/vmui"
];
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
Expand All @@ -46,7 +65,11 @@ buildGoModule rec {
--replace "time.NewTimer(time.Second * 10)" "time.NewTimer(time.Second * 120)" \
'';

ldflags = [ "-s" "-w" "-X github.com/VictoriaMetrics/VictoriaMetrics/lib/buildinfo.Version=${version}" ];
ldflags = [
"-s"
"-w"
"-X github.com/VictoriaMetrics/VictoriaMetrics/lib/buildinfo.Version=${version}"
];

preCheck = ''
# `lib/querytracer/tracer_test.go` expects `buildinfo.Version` to be unset
Expand All @@ -55,13 +78,21 @@ buildGoModule rec {

__darwinAllowLocalNetworking = true;

passthru.tests = { inherit (nixosTests) victoriametrics; };
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 ];
maintainers = with maintainers; [
yorickvp
ivan
nullx76
leona
shawn8901
];
changelog = "https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v${version}";
mainProgram = "victoria-metrics";
};
Expand Down
12 changes: 12 additions & 0 deletions pkgs/by-name/vm/vmagent/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{ lib, victoriametrics }:
lib.addMetaAttrs { mainProgram = "vmagent"; } (
victoriametrics.override {
withServer = false;
withVictoriaLogs = false;
withVmAlert = false;
withVmAuth = false;
withBackupTools = false;
withVmctl = false;
withVmAgent = true;
}
)
27 changes: 0 additions & 27 deletions pkgs/servers/monitoring/vmagent/default.nix

This file was deleted.

2 changes: 0 additions & 2 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26531,8 +26531,6 @@ with pkgs;

virtualenv-clone = with python3Packages; toPythonApplication virtualenv-clone;

vmagent = callPackage ../servers/monitoring/vmagent { };

vsftpd = callPackage ../servers/ftp/vsftpd { };

wallabag = callPackage ../servers/web-apps/wallabag { };
Expand Down