nix/container/Redis.nix

32 lines
658 B
Nix
Raw Normal View History

2024-06-25 04:04:39 +03:00
{ container, pkgs, util, lib, config, ... }: with lib; let
cfg = config.container.module.redis;
2024-06-09 23:35:53 +03:00
in {
2024-06-25 04:04:39 +03:00
options = {
container.module.redis = {
enable = mkEnableOption "Redis server.";
address = mkOption {
default = "10.1.0.38";
type = types.str;
};
port = mkOption {
default = 6379;
type = types.int;
};
};
};
config = mkIf cfg.enable {
containers.redis = container.mkContainer cfg {
config = { ... }: container.mkContainerConfig cfg {
services.redis.servers.main = {
enable = true;
port = cfg.port;
bind = cfg.address;
extraParams = [ "--protected-mode no" ];
};
2024-06-09 23:35:53 +03:00
};
};
};
}