8 cfg = config.services.gatus;
10 settingsFormat = pkgs.formats.yaml { };
31 options.services.gatus = {
32 enable = mkEnableOption "Gatus";
34 package = mkPackageOption pkgs "gatus" { };
36 configFile = mkOption {
38 default = settingsFormat.generate "gatus.yaml" cfg.settings;
39 defaultText = literalExpression ''
40 let settingsFormat = pkgs.formats.yaml { }; in settingsFormat.generate "gatus.yaml" cfg.settings;
43 Path to the Gatus configuration file.
44 Overrides any configuration made using the `settings` option.
48 environmentFile = mkOption {
52 File to load as environment file.
53 Environmental variables from this file can be interpolated in the configuration file using `''${VARIABLE}`.
54 This is useful to avoid putting secrets into the nix store.
60 freeformType = settingsFormat.type;
66 The TCP port to serve the Gatus service at.
74 example = literalExpression ''
79 url = "https://twin.sh/health";
84 "[RESPONSE_TIME] < 300"
91 Configuration for Gatus.
92 Supported options can be found at the [docs](https://gatus.io/docs).
96 openFirewall = mkOption {
100 Whether to open the firewall for the Gatus web interface.
105 config = mkIf cfg.enable {
106 systemd.services.gatus = {
107 description = "Automated developer-oriented status page";
108 after = [ "network.target" ];
109 wantedBy = [ "multi-user.target" ];
116 Restart = "on-failure";
117 ExecStart = getExe cfg.package;
118 StateDirectory = "gatus";
119 SyslogIdentifier = "gatus";
120 EnvironmentFile = lib.optional (cfg.environmentFile != null) cfg.environmentFile;
124 GATUS_CONFIG_PATH = cfg.configFile;
128 networking.firewall.allowedTCPPorts = lib.optionals cfg.openFirewall [ cfg.settings.web.port ];
131 meta.maintainers = with maintainers; [ pizzapim ];