diff --git a/hosts/FredOS-Mediaserver.nix b/hosts/FredOS-Mediaserver.nix index f161a35..3f6a48b 100644 --- a/hosts/FredOS-Mediaserver.nix +++ b/hosts/FredOS-Mediaserver.nix @@ -13,11 +13,20 @@ nix.settings.cores = 8; nix.daemonCPUSchedPolicy = "batch"; systemd.services.nix-daemon.serviceConfig = { - MemoryHigh = "12G"; - MemoryMax = "16G"; + MemoryHigh = "8G"; + MemoryMax = "10G"; OOMPolicy = "continue"; # a killed build shouldn't stop the daemon }; + # System-wide backstop for whatever else runs away. oomd was running but + # monitoring nothing; now it kills the worst cgroup once memory stalls + # hit 80% for 30s (start of a thrash, not 10h in). + systemd.oomd.enableRootSlice = true; + systemd.oomd.enableSystemSlice = true; + # Keep 1G truly free (default ~88M) so kernel networking and the watchdog + # can still allocate while userspace is squeezed. + boot.kernel.sysctl."vm.min_free_kbytes" = 1048576; + # Basic system packages environment.systemPackages = with pkgs; [ mergerfs