# Protect my system from running out of storage or memory let totalStorage = 930; in { nix.settings = { min-free = builtins.ceil (totalStorage * 0.2) * 1024 * 1024 * 1024; max-free = builtins.ceil (totalStorage * 0.3) * 1024 * 1024 * 1024; }; systemd.services.nix-daemon.serviceConfig = { MemoryAccounting = true; MemoryMax = "90%"; OOMScoreAdjust = 500; }; }