mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-10 11:45:45 +03:00

Format all Nix files using the officially approved formatter,
making the CI check introduced in the previous commit succeed:
nix-build ci -A fmt.check
This is the next step of the of the [implementation](https://github.com/NixOS/nixfmt/issues/153)
of the accepted [RFC 166](https://github.com/NixOS/rfcs/pull/166).
This commit will lead to merge conflicts for a number of PRs,
up to an estimated ~1100 (~33%) among the PRs with activity in the past 2
months, but that should be lower than what it would be without the previous
[partial treewide format](https://github.com/NixOS/nixpkgs/pull/322537).
Merge conflicts caused by this commit can now automatically be resolved while rebasing using the
[auto-rebase script](8616af08d9/maintainers/scripts/auto-rebase
).
If you run into any problems regarding any of this, please reach out to the
[formatting team](https://nixos.org/community/teams/formatting/) by
pinging @NixOS/nix-formatting.
126 lines
3.1 KiB
Nix
126 lines
3.1 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
|
|
with lib;
|
|
|
|
let
|
|
cfg = config.services.trickster;
|
|
in
|
|
{
|
|
imports = [
|
|
(mkRenamedOptionModule [ "services" "trickster" "origin" ] [ "services" "trickster" "origin-url" ])
|
|
];
|
|
|
|
options = {
|
|
services.trickster = {
|
|
enable = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
description = ''
|
|
Enable Trickster.
|
|
'';
|
|
};
|
|
|
|
package = mkPackageOption pkgs "trickster" { };
|
|
|
|
configFile = mkOption {
|
|
type = types.nullOr types.path;
|
|
default = null;
|
|
description = ''
|
|
Path to configuration file.
|
|
'';
|
|
};
|
|
|
|
instance-id = mkOption {
|
|
type = types.nullOr types.int;
|
|
default = null;
|
|
description = ''
|
|
Instance ID for when running multiple processes (default null).
|
|
'';
|
|
};
|
|
|
|
log-level = mkOption {
|
|
type = types.str;
|
|
default = "info";
|
|
description = ''
|
|
Level of Logging to use (debug, info, warn, error) (default "info").
|
|
'';
|
|
};
|
|
|
|
metrics-port = mkOption {
|
|
type = types.port;
|
|
default = 8082;
|
|
description = ''
|
|
Port that the /metrics endpoint will listen on.
|
|
'';
|
|
};
|
|
|
|
origin-type = mkOption {
|
|
type = types.enum [
|
|
"prometheus"
|
|
"influxdb"
|
|
];
|
|
default = "prometheus";
|
|
description = ''
|
|
Type of origin (prometheus, influxdb)
|
|
'';
|
|
};
|
|
|
|
origin-url = mkOption {
|
|
type = types.str;
|
|
default = "http://prometheus:9090";
|
|
description = ''
|
|
URL to the Origin. Enter it like you would in grafana, e.g., http://prometheus:9090 (default http://prometheus:9090).
|
|
'';
|
|
};
|
|
|
|
profiler-port = mkOption {
|
|
type = types.nullOr types.port;
|
|
default = null;
|
|
description = ''
|
|
Port that the /debug/pprof endpoint will listen on.
|
|
'';
|
|
};
|
|
|
|
proxy-port = mkOption {
|
|
type = types.port;
|
|
default = 9090;
|
|
description = ''
|
|
Port that the Proxy server will listen on.
|
|
'';
|
|
};
|
|
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
systemd.services.trickster = {
|
|
description = "Reverse proxy cache and time series dashboard accelerator";
|
|
after = [ "network.target" ];
|
|
wantedBy = [ "multi-user.target" ];
|
|
serviceConfig = {
|
|
DynamicUser = true;
|
|
ExecStart = ''
|
|
${cfg.package}/bin/trickster \
|
|
-log-level ${cfg.log-level} \
|
|
-metrics-port ${toString cfg.metrics-port} \
|
|
-origin-type ${cfg.origin-type} \
|
|
-origin-url ${cfg.origin-url} \
|
|
-proxy-port ${toString cfg.proxy-port} \
|
|
${optionalString (cfg.configFile != null) "-config ${cfg.configFile}"} \
|
|
${optionalString (cfg.profiler-port != null) "-profiler-port ${cfg.profiler-port}"} \
|
|
${optionalString (cfg.instance-id != null) "-instance-id ${cfg.instance-id}"}
|
|
'';
|
|
ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
|
|
Restart = "always";
|
|
};
|
|
};
|
|
};
|
|
|
|
meta.maintainers = with maintainers; [ _1000101 ];
|
|
|
|
}
|