From dec0fd139b7f103a1e2249f17158a733c2f1ffc4 Mon Sep 17 00:00:00 2001 From: Alexander Wainwright Date: Thu, 27 Nov 2025 21:52:03 +1000 Subject: [PATCH] Add some ram management stuff This will: - Add a 1GB swap file - Enable zram - Enable early oom --- hosts/modules/base.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/hosts/modules/base.nix b/hosts/modules/base.nix index 0bf5503..6bb04db 100644 --- a/hosts/modules/base.nix +++ b/hosts/modules/base.nix @@ -11,6 +11,18 @@ shell = pkgs.fish; }; + # enable a 1GB swap file + swapDevices = [{ + device = "/swapfile"; + size = 1024; + }]; + + # enable zram. not totally sure if this does it in physical ram or just swap + zramSwap.enable = true; + + # enable earlyoom to stop the system becoming unresponsive when out of ram + services.earlyoom.enable = true; + networking.firewall.allowedTCPPorts = [ 8000 8080 ]; # Set your time zone.