nix/modules/nixos/services/redis/default.nix
Ameya Shenoy 4998e822a7 feat: init
Signed-off-by: Ameya Shenoy <shenoy.ameya@gmail.com>
2024-11-11 01:48:40 +05:30

28 lines
836 B
Nix

{ config, lib, ... }: {
options.snowflake.services.redis = {
enable = lib.mkEnableOption "Enable redis configuration";
servers = lib.mkOption {
type = lib.types.attrsOf (lib.types.submodule {
options = {
enable = lib.mkOption {
type = lib.types.bool;
default = true;
description = "whether to enable this particular redis server.";
};
port = lib.mkOption {
type = lib.types.port;
description = "port number to host this redis on.";
};
};
});
};
};
config = lib.mkIf config.snowflake.services.redis.enable {
services.redis.servers = lib.mapAttrs (redisname: redisCfg: {
enable = redisCfg.enable;
port = redisCfg.port;
}) config.snowflake.services.redis.servers;
};
}