54 lines
1.4 KiB
Nix
54 lines
1.4 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
let
|
|
probesFormat = pkgs.formats.json { };
|
|
cfg = config.statelessUptimeKuma;
|
|
in
|
|
{
|
|
options.statelessUptimeKuma = {
|
|
build = {
|
|
json = lib.mkOption { type = lib.types.package; };
|
|
script = lib.mkOption { type = lib.types.package; };
|
|
};
|
|
extraFlags = lib.mkOption {
|
|
default = [ ];
|
|
example = [ "--scrape-http-keywords" ];
|
|
type = with lib.types; listOf str;
|
|
description = lib.mdDoc ''
|
|
Extra arguments to use for executing `stateless-uptime-kuma`.
|
|
'';
|
|
};
|
|
lib = lib.mkOption { type = lib.types.raw; };
|
|
probesConfig = {
|
|
monitors = lib.mkOption {
|
|
type = with lib.types; attrsOf probesFormat.type;
|
|
default = { };
|
|
};
|
|
tags = lib.mkOption {
|
|
type = with lib.types; attrsOf probesFormat.type;
|
|
default = { };
|
|
};
|
|
notifications = lib.mkOption {
|
|
type = with lib.types; attrsOf probesFormat.type;
|
|
default = { };
|
|
};
|
|
};
|
|
};
|
|
config.statelessUptimeKuma = {
|
|
lib = import ../lib { inherit lib; };
|
|
build = {
|
|
json = probesFormat.generate "probes.json" cfg.probesConfig;
|
|
script = pkgs.writeShellApplication {
|
|
name = "deploy-uptime-kuma-probes";
|
|
runtimeInputs = [ pkgs.statelessUptimeKuma ];
|
|
text = ''
|
|
stateless-uptime-kuma apply-json -f ${cfg.build.json} ${builtins.concatStringsSep " " cfg.extraFlags}
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
}
|