Why I Switched from ZRAM to Zswap for Hibernate on NixOS

Swap, ZRAM, Zswap and Hibernate on NixOS

I use swap on my NixOS desktop and laptop to enable suspend-then-hibernate, which first suspends to RAM and then hibernates to disk after a delay. After mistakenly using zramSwap, I switched to boot.zswap.enable with vm.swappiness = 100. I also settled on zstd compression instead of lz4, since a better compression ratio lets more pages stay in memory and reduces disk usage. My final config is just two lines.

So to clarify, zramSwap is what is normally just referred to as zram. It is likely not what you want when using disk based swap.

More from this day

2026-09-23