nixos/redis: Disable hugepages for redis via sysctl and not via a systemd-oneshot

This commit is contained in:
Malte Brandy 2019-10-21 22:36:27 +02:00
parent 2695914175
commit fe143bac5b

View file

@ -186,9 +186,9 @@ in
config = mkIf config.services.redis.enable {
boot.kernel.sysctl = mkIf cfg.vmOverCommit {
"vm.overcommit_memory" = "1";
};
boot.kernel.sysctl = {
"vm.nr_hugepages" = "0";
} // mkIf cfg.vmOverCommit { "vm.overcommit_memory" = "1"; };
networking.firewall = mkIf cfg.openFirewall {
allowedTCPPorts = [ cfg.port ];
@ -198,14 +198,6 @@ in
environment.systemPackages = [ cfg.package ];
systemd.services.disable-transparent-huge-pages = {
description = "Disable Transparent Huge Pages (required by Redis)";
before = [ "redis.service" ];
wantedBy = [ "redis.service" ];
script = "echo never > /sys/kernel/mm/transparent_hugepage/enabled";
serviceConfig.Type = "oneshot";
};
systemd.services.redis =
{ description = "Redis Server";