From b2ffed30952fbe1e90cd28755d6121c41f90f1f6 Mon Sep 17 00:00:00 2001 From: mjallen18 Date: Mon, 22 Jul 2024 10:20:12 -0500 Subject: [PATCH] test redis --- hosts/nas/configuration.nix | 2 ++ modules/apps/nextcloud/default.nix | 3 +++ modules/apps/redis/default.nix | 24 ++++++++++++++++++++++++ modules/apps/redis/options.nix | 27 +++++++++++++++++++++++++++ modules/default.nix | 1 + 5 files changed, 57 insertions(+) create mode 100644 modules/apps/redis/default.nix create mode 100644 modules/apps/redis/options.nix diff --git a/hosts/nas/configuration.nix b/hosts/nas/configuration.nix index aa70147..cef9f79 100755 --- a/hosts/nas/configuration.nix +++ b/hosts/nas/configuration.nix @@ -88,6 +88,8 @@ in radarr.enable = true; + redis.enable = true; + sabnzbd.enable = true; sonarr.enable = true; diff --git a/modules/apps/nextcloud/default.nix b/modules/apps/nextcloud/default.nix index a4e9946..daca4c9 100644 --- a/modules/apps/nextcloud/default.nix +++ b/modules/apps/nextcloud/default.nix @@ -27,6 +27,9 @@ in PUID = cfg.puid; PGID = cfg.pgid; TZ = cfg.timeZone; + REDIS_HOST = "10.0.1.18"; + REDIS_PORT = "6379"; + REDIS_HOST_PASSWORD = "BogieDudie1"; }; }; }; diff --git a/modules/apps/redis/default.nix b/modules/apps/redis/default.nix new file mode 100644 index 0000000..182b54b --- /dev/null +++ b/modules/apps/redis/default.nix @@ -0,0 +1,24 @@ +{ + lib, + pkgs, + config, + ... +}: +with lib; +let + cfg = config.nas-apps.redis; +in +{ + imports = [ ./options.nix ]; + + config = mkIf cfg.enable { + virtualisation.oci-containers.containers."${cfg.name}" = { + autoStart = cfg.autoStart; + image = cfg.image; + cmd = cfg.cmd; + ports = [ + "6379:6379" + ]; + }; + }; +} diff --git a/modules/apps/redis/options.nix b/modules/apps/redis/options.nix new file mode 100644 index 0000000..c584558 --- /dev/null +++ b/modules/apps/redis/options.nix @@ -0,0 +1,27 @@ +{ lib, ... }: +with lib; +{ + options.nas-apps.redis = { + enable = mkEnableOption "redis docker service"; + + autoStart = mkOption { + type = types.bool; + default = true; + }; + + name = mkOption { + type = types.str; + default = "redis"; + }; + + image = mkOption { + type = types.str; + default = "redis"; + }; + + cmd = mkOption { + type = types.str; + default = "redis-server --requirepass BogieDudie1"; + }; + }; +} diff --git a/modules/default.nix b/modules/default.nix index 3726612..5afe26b 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -19,6 +19,7 @@ ./apps/orca-slicer ./apps/puter ./apps/radarr + ./apps/redis ./apps/sabnzbd ./apps/sonarr ./apps/swag