nix-darwin icon indicating copy to clipboard operation
nix-darwin copied to clipboard

default redis dataDir is not auto created

Open zhengpd opened this issue 1 year ago • 1 comments

If /var/lib/redis dir does not exist, services.redis.enable = true would fail silently. It succeeds after /var/lib/redis created.

❯ /nix/store/hgkxn25dcp03lpxpz138kczw0xyxi3q4-redis-7.0.11/bin/redis-server /etc/redis.conf

*** FATAL CONFIG FILE ERROR (Redis 7.0.11) ***
Reading the configuration file, at line 4
>>> 'dir /var/lib/redis'
No such file or directory

It should either create the directory automatically, or tell user to create it manually.

zhengpd avatar May 15 '23 00:05 zhengpd

system.activationScripts.preActivation = {
  enable = true;
  text = ''
    if [ ! -d "/var/lib/redis/" ]; then
      echo "creating Redis data directory..."
      sudo mkdir -m 750 -p /var/lib/redis/
      chown -R ecklf:staff /var/lib/redis/
    fi
  '';
};

Here is a workaround until fixed.

ecklf avatar Nov 15 '23 20:11 ecklf