[NixOS] Set Up Zram Swap The article explains that NixOS can use zramSwap, which creates a compressed swap space in RAM via the kernel's zram module, offering a faster alternative to disk-based swap and reducing SSD wear. It provides configuration steps, including enabling the module, setting priority, algorithm, and memory percentage, while noting trade-offs like CPU usage for compression and incompatibility with hibernation. zramSwap in NixOS enables compressed swap space in RAM using the kernel's zram module, acting as a faster, disk-free alternative to traditional swap partitions or files. It's ideal for systems with sufficient RAM and helps reduce SSD wear. - Enable zramSwap in your configuration with: boot.kernelModules = "zram" ; zramSwap = { enable = true; priority = 100; Higher than disk swap to prefer zram algorithm = "zstd"; Balances speed and compression memoryPercent = 50; Use up to 50% of RAM for zram }; - Key benefits: Faster than disk swap, no disk I/O, reduces SSD wear. - Trade-offs: Uses CPU for compression; not suitable for hibernation requires a swap partition equal to RAM size . - Advanced use: Supports writeback to a disk device for incompressible data via writebackDevice . For detailed options, see the NixOS Wiki or the zram.nix module source.