diff --git a/modules/system/services/it-tools.nix b/modules/system/services/it-tools.nix new file mode 100644 index 0000000..40f3c7b --- /dev/null +++ b/modules/system/services/it-tools.nix @@ -0,0 +1,39 @@ +{ + 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" = { + group = "Public"; + url = "https://${cfg.domain}/health"; + extraConditions = [ "[BODY] == OK" ]; + }; + }; +}