nixos-config/modules/system/services/it-tools.nix

38 lines
753 B
Nix

{
config,
pkgs,
lib,
...
}:
let
cfg = config.custom.services.it-tools;
in
{
options.custom.services.it-tools = {
enable = lib.mkEnableOption "";
domain = lib.mkOption {
type = lib.types.nonEmptyStr;
default = "";
};
port = lib.mkOption {
type = lib.types.port;
default = 8787;
};
};
config = lib.mkIf cfg.enable {
meta.ports.list = [ cfg.port ];
services.static-web-server = {
enable = true;
listen = "[::]:${toString cfg.port}";
root = "${pkgs.it-tools}/lib";
configuration.general.health = true;
};
custom.services.gatus.endpoints."IT Tools" = {
url = "https://${cfg.domain}/health";
extraConditions = [ "[BODY] == OK" ];
};
};
}