infrastructure/nixos/monitoring.nix
2024-05-30 14:47:48 -07:00

22 lines
537 B
Nix

{
config,
lib,
...
}: let
inherit (lib.modules) mkIf mkMerge;
inherit (config.services) grafana loki prometheus;
in {
services = {
grafana.enable = true;
loki.enable = true;
prometheus.enable = true;
};
networking.firewall.interfaces.lan.allowedTCPPorts = mkMerge [
(mkIf grafana.enable [ grafana.port ])
(mkIf loki.enable [
loki.settings.httpListenPort
(mkIf (loki.settings.grpcListenPort != 0) loki.settings.grpcListenPort)
])
(mkIf prometheus.enable [ prometheus.port ])
];
}