{ config, lib, this, ... }: with lib; let cfg = config.nixfiles.modules.redis; in { options.nixfiles.modules.redis.enable = mkEnableOption "Redis"; config = mkIf cfg.enable { ark.directories = [ "/var/lib/redis-default" ]; services = { redis = { servers.default = { enable = true; bind = "127.0.0.1"; port = 6379; }; vmOverCommit = true; }; prometheus.exporters = { redis = { enable = true; listenAddress = mkDefault this.wireguard.ipv4.address; port = mkDefault 9121; extraFlags = with config.services.redis.servers.default; [ "--redis.addr=redis://${bind}:${toString port}" "--redis.user=${user}" ]; }; }; }; }; }