]> Git — Sourcephile - sourcephile-nix.git/blob - hosts/mermet/redis.nix
gitolite: add on losurdo
[sourcephile-nix.git] / hosts / 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 bind = "127.0.0.1 ::1";
12 settings = {
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 }