]> Git — Sourcephile - sourcephile-nix.git/blob - hosts/mermet/redis.nix
gnupg: disable building pinentry UIs
[sourcephile-nix.git] / hosts / mermet / redis.nix
1 { pkgs, lib, config, ... }:
2 let
3 inherit (config.users) users;
4 in
5 {
6 fileSystems."/var/lib/redis" = {
7 device = "rpool/var/redis";
8 fsType = "zfs";
9 };
10
11 services.redis = {
12 enable = true;
13 unixSocket = "/run/redis/redis.socket";
14 databases = 16;
15 syslog = true;
16 bind = "127.0.0.1 ::1";
17 settings = {
18 unixsocketperm = "660";
19 maxclients = 1024;
20 maxmemory = "500mb";
21 maxmemory-policy = "volatile-ttl";
22 };
23 };
24
25 users.users.redis.group = "redis";
26 users.groups."redis" = {};
27
28 systemd.services.redis.serviceConfig = {
29 RuntimeDirectoryMode = "0750";
30 Group = users.redis.group;
31 };
32
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
37 '';
38 }