remove vmagent (has now been upstreamed)

This commit is contained in:
Vivian 2022-10-20 10:54:24 +02:00
parent 2f348356bc
commit 272285ceea
6 changed files with 31 additions and 165 deletions

View file

@ -3,7 +3,6 @@
./dns.nix
./flood.nix
./unpackerr.nix
./vmagent.nix
./vault.nix
];
}

View file

@ -1,107 +0,0 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.services.vmagent;
settingsFormat = pkgs.formats.json { };
in {
options.services.vmagent = {
enable = mkEnableOption "vmagent";
user = mkOption {
default = "vmagent";
type = types.str;
description = ''
User account under which vmagent runs.
'';
};
group = mkOption {
type = types.str;
default = "vmagent";
description = ''
Group under which vmagent runs.
'';
};
package = mkOption {
default = pkgs.vmagent;
defaultText = "pkgs.vmagent";
type = types.package;
description = ''
vmagent package to use.
'';
};
dataDir = mkOption {
type = types.str;
default = "/var/lib/vmagent";
description = ''
The directory where vmagent stores its data files.
'';
};
remoteWriteUrl = mkOption {
default = "http://localhost:8428/api/v1/write";
type = types.str;
description = ''
The remote storage endpoint such as VictoriaMetrics
'';
};
prometheusConfig = mkOption {
type = lib.types.submodule { freeformType = settingsFormat.type; };
description = ''
Config for prometheus style metrics
'';
};
openFirewall = mkOption {
type = types.bool;
default = false;
description = ''
Whether to open the firewall for the default ports.
'';
};
};
config = mkIf cfg.enable {
# Create group if set to default
users.groups = mkIf (cfg.group == "vmagent") { vmagent = { }; };
# Create user if set to default
users.users = mkIf (cfg.user == "vmagent") {
vmagent = {
group = cfg.group;
shell = pkgs.bashInteractive;
description = "vmagent daemon user";
home = cfg.dataDir;
isSystemUser = true;
};
};
# Open firewall if option is set to do so.
networking.firewall.allowedTCPPorts = mkIf (cfg.openFirewall) [ 8429 ];
# The actual service
systemd.services.vmagent = let
prometheusConfig =
settingsFormat.generate "prometheusConfig.yaml" cfg.prometheusConfig;
in {
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
description = "vmagent system service";
serviceConfig = {
User = cfg.user;
Group = cfg.group;
Type = "simple";
Restart = "on-failure";
WorkingDirectory = cfg.dataDir;
ExecStart =
"${cfg.package}/bin/vmagent -remoteWrite.url=${cfg.remoteWriteUrl} -promscrape.config=${prometheusConfig}";
};
};
systemd.tmpfiles.rules =
[ "d '${cfg.dataDir}' 0755 ${cfg.user} ${cfg.group} -" ];
};
}

View file

@ -31,6 +31,7 @@
windowrulev2 = workspace 1 silent,class:^(Electron)$,title:^(.*)(WebCord)(.*)$
windowrulev2 = workspace 1 silent,title:^(Element)(.*)$
windowrulev2 = workspace 2 silent,class:^(firefox-aurora)$
windowrulev2 = float,class:^(firefox-aurora)$,title:^(Picture-in-Picture)$
general {
layout = dwindle
@ -66,7 +67,7 @@
bind=SUPER,W,killactive,
bind=SUPERSHIFT,Q,exit,
bind=SUPER,S,togglefloating,
bind=SUPER,P,pseudo,
bind=SUPER,P,pin,
bindm=SUPER,mouse:272,movewindow
bindm=SUPER,mouse:273,resizewindow

View file

@ -2,8 +2,6 @@
final: prev: {
catppuccin.cursors = prev.callPackage ./catppuccin/cursors { };
vmagent = prev.callPackage ./vmagent { };
v = {
glitch-soc = prev.callPackage ./glitch-soc { };
@ -21,7 +19,8 @@ final: prev: {
gitea-agatheme = prev.callPackage ./gitea-agatheme { };
vscode-extensions = {
platformio.platformio-ide = prev.callPackage ./vscode-extensions/platformio.nix { };
platformio.platformio-ide =
prev.callPackage ./vscode-extensions/platformio.nix { };
};
};
}

View file

@ -1,26 +0,0 @@
{ lib, fetchFromGitHub, buildGoModule }:
buildGoModule rec {
pname = "vmagent";
version = "1.82.0";
src = fetchFromGitHub {
owner = "VictoriaMetrics";
repo = "VictoriaMetrics";
rev = "v${version}";
sha256 = "JIl2WeveDoAHzqJ2cqMxpWeNf4yQC9fIdfECOJywJ2A=";
};
ldflags = [ "-s" "-w" "-X github.com/VictoriaMetrics/VictoriaMetrics/lib/buildinfo.Version=${version}" ];
vendorSha256 = null;
subPackages = [ "app/vmagent" ];
meta = with lib; {
homepage = "https://github.com/VictoriaMetrics/VictoriaMetrics/tree/master/app/vmagent";
description = "VictoriaMetrics metrics scraper";
license = licenses.asl20;
platforms = platforms.linux;
maintainers = with maintainers; [ nullx76 ];
};
}