From c39d570d19f80816d476caff4ad952c5e0b3707f Mon Sep 17 00:00:00 2001 From: rope Date: Sun, 27 Sep 2026 08:30:05 +0100 Subject: [PATCH] Mediaserver: oomd backstop, 1G min_free, tighter nix cap Co-Authored-By: Claude Opus 5.5 --- hosts/FredOS-Mediaserver.nix | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) 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