yumeami/modules/nixos/services/apps/prometheus/default.nix
C4 Patino 0fd70dd3f8
Some checks failed
ci / treefmt (push) Failing after 4s
feat: fix all initial impermanence perm folder creation
2026-07-01 01:45:06 -05:00

26 lines
683 B
Nix

{
config,
lib,
namespace,
...
}: let
inherit (lib) mkIf;
inherit (lib.${namespace}) getAttrByNamespace hostHasService resolveServicePort mkPersistDir;
inherit (config.networking) hostName;
networkCfg = getAttrByNamespace config "${namespace}.services.networking";
isEnabled = hostHasService networkCfg.network-services hostName "prometheus";
port = resolveServicePort networkCfg.network-services "prometheus" 9090;
in {
config = mkIf isEnabled {
services.prometheus = {
enable = true;
port = port;
};
${namespace}.services.storage.impermanence.folders = [
(mkPersistDir config "prometheus" "/var/lib/prometheus2")
];
};
}