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 = lib.mkForce "660";
21 maxmemory-policy = "volatile-ttl";
25 users.users.redis.group = "redis";
26 users.groups."redis" = {};
28 systemd.services.redis.serviceConfig = {
29 RuntimeDirectoryMode = "0750";
30 Group = users.redis.group;
33 # As suggested by redis in its logs
34 boot.kernel.sysctl."vm.overcommit_memory" = 1;
35 system.activationScripts.redis = ''
36 echo never >/sys/kernel/mm/transparent_hugepage/enabled