]> Git — Sourcephile - sourcephile-nix.git/blob - machines/mermet/redis.nix
losurdo: revert to static IPv4 to see if DHCP is the problem after an electric failure
[sourcephile-nix.git] / machines / mermet / redis.nix
1 { pkgs, lib, config, ... }:
2 let
3 inherit (config.users) users;
4 in
5 {
6 services.redis = {
7 enable = true;
8 unixSocket = "/run/redis/redis.socket";
9 databases = 16;
10 syslog = true;
11 extraConfig = ''
12 bind 127.0.0.1 ::1
13 unixsocketperm 660
14 maxclients 1024
15 maxmemory 500mb
16 maxmemory-policy volatile-ttl
17 '';
18 };
19
20 users.users.redis.group = "redis";
21 users.groups."redis" = {};
22
23 systemd.services.redis.serviceConfig = {
24 RuntimeDirectoryMode = "0750";
25 Group = users.redis.group;
26 };
27
28 # As suggested by redis in its logs
29 boot.kernel.sysctl."vm.overcommit_memory" = 1;
30 system.activationScripts.redis = ''
31 echo never >/sys/kernel/mm/transparent_hugepage/enabled
32 '';
33 }