Commit 25ed84550e29

Vincent Demeester <vincent@sbr.pm>
2026-02-16 10:29:01
feat(systems): added systemd-oomd to prevent swap exhaustion freezes
Enabled systemd-oomd on all three laptops (aomi, kyushu, okinawa) to prevent system freezes when memory runs low. Uses memory pressure metrics to kill processes/slices before swap exhaustion hangs system.
1 parent 8046912
Changed files (4)
systems
aomi
common
services
kyushu
okinawa
systems/aomi/extra.nix
@@ -24,6 +24,7 @@
     # ../common/services/ollama.nix # TODO handle nvidia vs not ?
     ../common/services/prometheus-exporters-node.nix
     # ../common/services/gitea-runner
+    ../common/services/oomd.nix
 
     ../redhat
 
systems/common/services/oomd.nix
@@ -0,0 +1,12 @@
+{ ... }:
+{
+  # Out-of-memory management with systemd-oomd
+  # Uses memory pressure metrics (PSI) to kill processes/slices before system hangs
+  # Particularly useful for laptops with unpredictable memory usage (browsers, dev tools)
+  systemd.oomd = {
+    enable = true;
+    enableRootSlice = true; # Monitor / cgroup
+    enableSystemSlice = true; # Monitor system services
+    enableUserSlices = true; # Monitor user sessions (browsers, etc.)
+  };
+}
systems/kyushu/extra.nix
@@ -17,6 +17,7 @@
     ../common/services/docker.nix
     ../common/services/libvirt.nix
     ../common/services/binfmt.nix
+    ../common/services/oomd.nix
     ../../modules/laptop-keyboard-inhibit
 
     ../redhat
systems/okinawa/extra.nix
@@ -13,6 +13,7 @@
     ../common/services/containers.nix
     ../common/services/docker.nix
     ../common/services/prometheus-exporters-node.nix
+    ../common/services/oomd.nix
     ../../modules/laptop-keyboard-inhibit
   ];