summaryrefslogtreecommitdiff
path: root/parts
diff options
context:
space:
mode:
authorseth <[email protected]>2023-11-30 23:30:00 -0500
committerseth <[email protected]>2023-12-01 07:12:49 -0500
commit85402f9103b55dff65c6a6079c6902080e5a30a6 (patch)
treeeba04a9f9938ac1d7ac14cb5d7bc5e0fb8f4db16 /parts
parent41dfa94258215769b9d844875e79097d4a498770 (diff)
feat: add redis for reactboard
Diffstat (limited to 'parts')
-rw-r--r--parts/dev.nix5
-rw-r--r--parts/module.nix15
2 files changed, 20 insertions, 0 deletions
diff --git a/parts/dev.nix b/parts/dev.nix
index 4cd51d6..5628e33 100644
--- a/parts/dev.nix
+++ b/parts/dev.nix
@@ -49,12 +49,17 @@
pkgs.linkFarm "ci-gate" paths;
};
+ proc.groups.daemons.processes = {
+ redis.command = lib.getExe' pkgs.redis "redis-server";
+ };
+
devShells = {
default = pkgs.mkShell {
packages = with pkgs; [
# general
actionlint
nodePackages_latest.prettier
+ config.proc.groups.daemons.package
# rust
cargo
diff --git a/parts/module.nix b/parts/module.nix
index 5c1af12..5048c13 100644
--- a/parts/module.nix
+++ b/parts/module.nix
@@ -22,6 +22,18 @@ in {
options.services.teawiebot = {
enable = mkEnableOption "teawiebot";
package = mkPackageOption self.packages.${pkgs.stdenv.hostPlatform.system} "teawiebot" {};
+
+ redisUrl = mkOption {
+ description = mdDoc ''
+ Redis URL for teawieBot
+ '';
+ type = types.str;
+ default = "unix:${config.services.redis.servers.teawiebot.unixSocket}";
+ example = literalExpression ''
+ "redis://localhost/"
+ '';
+ };
+
environmentFile = mkOption {
description = mdDoc ''
Environment file as defined in {manpage}`systemd.exec(5)`
@@ -35,6 +47,8 @@ in {
};
config = mkIf cfg.enable {
+ services.redis.servers.teawiebot.enable = true;
+
systemd.services."teawiebot" = {
enable = true;
wantedBy = mkDefault ["multi-user.target"];
@@ -48,6 +62,7 @@ in {
Restart = "always";
EnvironmentFile = mkIf (cfg.environmentFile != null) cfg.environmentFile;
+ Environment = ["REDIS_URL=${cfg.redisUrl}"];
# hardening
DynamicUser = true;