From ef62b32474f7dd6cb886419f16ae9e52cc829768 Mon Sep 17 00:00:00 2001 From: Wilfred Allyn Date: Tue, 8 Apr 2025 18:21:33 -0400 Subject: [PATCH] feat: add redis --- devenv.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/devenv.nix b/devenv.nix index 697554937..6ba78f98d 100644 --- a/devenv.nix +++ b/devenv.nix @@ -11,12 +11,17 @@ }; # Function to add logging logic to any command - withLogging = command: logFile: "mkdir -p ${config.devenv.root}/logs && bash -c 'stdbuf -oL ${command} 2>&1 | tee -a ${config.devenv.root}/logs/${logFile}'"; + withLogging = command: logFile: '' + mkdir -p ${config.devenv.root}/logs + ${command} 2>&1 | stdbuf -oL tee -a ${config.devenv.root}/logs/${logFile} + ''; # Get all process names dynamically processNames = lib.attrNames config.processes; in { env.BITCOIND_DATADIR = config.devenv.root + "/.devenv/state/bitcoind"; + env.REDIS_HOST = "localhost"; + env.REDIS_PORT = "6379"; # Ensure logs directory exists before processes run tasks.create-logs-dir = { @@ -31,6 +36,7 @@ in { bitcoind pkgs.just pkgs.coreutils # Provides stdbuf for disabling output buffering + pkgs.redis ] ++ pkgs.lib.optionals pkgs.stdenv.isDarwin [pkgs.darwin.apple_sdk.frameworks.Security]; @@ -42,6 +48,7 @@ in { # https://devenv.sh/processes/ processes = { + redis = {exec = withLogging "mkdir -p ${config.devenv.root}/.devenv/state/redis && redis-server --dir ${config.devenv.root}/.devenv/state/redis --port $REDIS_PORT" "redis.log";}; local-pool = {exec = withLogging "cargo -C roles/pool -Z unstable-options run -- -c $DEVENV_ROOT/roles/pool/config-examples/pool-config-local-tp-example.toml" "local-pool.log";}; job-server = {exec = withLogging "cargo -C roles/jd-server -Z unstable-options run -- -c $DEVENV_ROOT/roles/jd-server/config-examples/jds-config-local-example.toml" "job-server.log";}; job-client = {exec = withLogging "cargo -C roles/jd-client -Z unstable-options run -- -c $DEVENV_ROOT/roles/jd-client/config-examples/jdc-config-local-example.toml" "job-client.log";};