From 5e50dd3a9e0066d7a92fea3dea0390919d7d88fc Mon Sep 17 00:00:00 2001 From: Sakooooo <78461130+Sakooooo@users.noreply.github.com> Date: Wed, 1 Jan 2025 14:29:01 +0400 Subject: [PATCH] redis --- modules/server/default.nix | 2 +- modules/server/redis.nix | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 modules/server/redis.nix diff --git a/modules/server/default.nix b/modules/server/default.nix index a2f614a1..9dfed1be 100644 --- a/modules/server/default.nix +++ b/modules/server/default.nix @@ -2,7 +2,7 @@ with lib; let cfg = config.void.server; in { - imports = [ ./dns ./nginx.nix ./services ./postgresql.nix ]; + imports = [ ./dns ./nginx.nix ./services ./postgresql.nix ./redis.nix ]; options.void.server = { isServer = mkEnableOption false; }; diff --git a/modules/server/redis.nix b/modules/server/redis.nix new file mode 100644 index 00000000..e8f73de2 --- /dev/null +++ b/modules/server/redis.nix @@ -0,0 +1,27 @@ +{ config, lib, pkgs, ... }: +let + inherit (lib) mkIf mkEnableOption; + cfg = config.void.server.redis; + srv = config.void.server; +in { + options.void.server.redis = { enable = mkEnableOption false; }; + + config = mkIf cfg.enable { + # Thank you NotAShelf (again lmao) + services.redis = { + enable = true; + vmOverCommit = true; + servers = mkIf srv.services.forgejo.enable { + forgejo = { + enable = true; + user = "forgejo"; + port = 6371; + databases = 16; + logLevel = "debug"; + requirePass = "forgejo"; + }; + }; + }; + }; +} +