Hi,
I have the following swap configuration in my configuration.nix on a system with 8GB of RAM
swapDevices = [ {
device = "/var/lib/swapfile";
size = 16*1024;
priority = 2;
# https://nixos.wiki/wiki/Swap#Encrypt_swap_with_random_key
randomEncryption.enable = true;
} ];
# add a zramSwap 29% of physical RAM size
# This refers to the uncompressed size, actual memory usage will be lower.
zramSwap = {
enable = true;
priority = 4;
memoryPercent = 29;
};
The system builds fine, but if my Swap usage exceeds the ~2GB of zramZwap it just completely freezes. Can’t use keyboard shortcuts to close windows, can’t even move the mouse cursor. At first I thought my SSD was just very slow so I left it running over night, still doesn’t do anything. If I remove randomEncryption.enable = true;
and rebuild I can use the full ~18GB of Swap, the system just gets slow (as expected) but does not completely freeze up.