This commit is contained in:
commit
30ce0dafc2
195 changed files with 8902 additions and 0 deletions
6
services/redis/default.nix
Normal file
6
services/redis/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./options.nix
|
||||
./service.nix
|
||||
];
|
||||
}
|
||||
12
services/redis/options.nix
Normal file
12
services/redis/options.nix
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{ lib, ... }:
|
||||
with lib;
|
||||
{
|
||||
options.machine.redis = {
|
||||
enable = mkEnableOption "Redis";
|
||||
port = mkOption {
|
||||
type = types.port;
|
||||
default = 6379;
|
||||
description = "Port to listen on.";
|
||||
};
|
||||
};
|
||||
}
|
||||
28
services/redis/service.nix
Normal file
28
services/redis/service.nix
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
sec,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (config.machine.redis)
|
||||
port
|
||||
enable
|
||||
;
|
||||
in
|
||||
with lib; mkIf enable {
|
||||
sops.secrets = {
|
||||
"redis/password" = { };
|
||||
};
|
||||
|
||||
networking.firewall = {
|
||||
allowedTCPPorts = [ port ];
|
||||
};
|
||||
|
||||
services.redis.servers."default" = {
|
||||
inherit enable;
|
||||
inherit port;
|
||||
bind = null;
|
||||
requirePassFile = sec."redis/password".path;
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue