41 lines
1.5 KiB
Nix
41 lines
1.5 KiB
Nix
{pkgs, lib, config, ...}:
|
|
with lib;
|
|
{
|
|
options.services = {
|
|
victoria-logs = {
|
|
enable = mkEnableOption "Enable the VictoriaLogs service";
|
|
dataPath = mkOption {
|
|
description = "Logging directory path for victoria-logs service";
|
|
default = "/Users/Zaphar/opt/victoria-logs";
|
|
};
|
|
listenAddr = mkOption {
|
|
description = "Socket Address to listen on";
|
|
default = "127.0.0.1:9428";
|
|
};
|
|
};
|
|
};
|
|
|
|
config = let
|
|
victoria-logsOutPath = "${config.services.victoria-logs.dataPath}/victoria-logs.out.log";
|
|
victoria-logsErrPath = "${config.services.victoria-logs.dataPath}/victoria-logs.err.log";
|
|
victoria-logsPidPath = "${config.services.victoria-logs.dataPath}/victoria-logs.pid";
|
|
in {
|
|
launchd.user.agents.victoria-logs = mkIf config.services.victoria-logs.enable {
|
|
serviceConfig = {
|
|
ProgramArguments = [
|
|
"${pkgs.clio}/bin/clio"
|
|
"--out-path=${victoria-logsOutPath}"
|
|
"--err-path=${victoria-logsErrPath}"
|
|
"--pid-file=${victoria-logsPidPath}"
|
|
"--"
|
|
"${pkgs.victoriametrics}/bin/victoria-logs"
|
|
"-storageDataPath=${config.services.victoria-logs.dataPath}/data"
|
|
"-httpListenAddr=${config.services.victoria-logs.listenAddr}"
|
|
];
|
|
KeepAlive = true;
|
|
RunAtLoad = true;
|
|
};
|
|
};
|
|
};
|
|
}
|