1 { pkgs, lib, config, ... }:
3 inherit (config.networking) hostName;
4 inherit (config.users) users;
7 fileSystems."/var/lib/redis" = {
8 device = "${hostName}/var/redis";
14 unixSocket = "/run/redis/redis.socket";
17 bind = "127.0.0.1 ::1";
19 unixsocketperm = "660";
22 maxmemory-policy = "volatile-ttl";
26 users.users.redis.group = "redis";
27 users.groups."redis" = {};
29 systemd.services.redis.serviceConfig = {
30 RuntimeDirectoryMode = "0750";
31 Group = users.redis.group;
34 # As suggested by redis in its logs
35 boot.kernel.sysctl."vm.overcommit_memory" = 1;
36 system.activationScripts.redis = ''
37 echo never >/sys/kernel/mm/transparent_hugepage/enabled