nixdots/system/shared/services/oomd.nix

21 lines
676 B
Nix
Raw Permalink Normal View History

2024-07-26 23:07:07 +00:00
{lib, ...}: {
2024-03-21 20:47:25 +00:00
systemd = {
# OOMd: Out Of Memory daemon
# By default, this will only kill cgroups. So either systemd services
# marked for killing uder OOM or (non-default, but enabled here) the entire user slice.
oomd = {
enable = true;
enableSystemSlice = true;
enableRootSlice = true;
enableUserSlices = true;
extraConfig = {
"DefaultMemoryPressureDurationSec" = "20s";
};
};
# Make nix builds more likely to get killed than other important services.
# The default for user slices is 100, and systemd-coredumpd is 500
services.nix-daemon.serviceConfig.OOMScoreAdjust = lib.mkDefault 350;
};
}