NixOS guide details swap, ZRAM, Zswap and hibernate configuration tradeoffs
A blog post walks through configuring swap on NixOS for desktops and laptops that use suspend-then-hibernate, contrasting swap partitions with swap files. It notes that swap files complicate hibernation because initramfs must locate the swap space before file systems mount, requiring an EFI variable to record the location at hibernation time. The author shares working configurations: a simple swap partition on a desktop, and a LUKS-encrypted btrfs swap file on a laptop using the disko luks-btrfs-subvolumes template.
GoKawiil's interpretation of the reporting above, not reported fact.
The post suggests NixOS has matured to automatically handle the offset calculations needed for swap-file-based hibernation, which could reduce a longstanding pain point for users wanting both encrypted storage and hibernate support. This kind of practical configuration guidance may help NixOS users avoid trial-and-error setups when balancing performance tools like ZRAM/Zswap against reliable hibernation.
- NixOS can now handle locating swap files for hibernation despite the initramfs ordering challenge.
- Swap partitions are simpler for hibernate, while swap files require extra EFI variable handling.
- The author provides example NixOS configs for both a plain swap partition and a LUKS-encrypted btrfs swap file.
Crucial MX500 1TB SATA SSD — Since hibernate on NixOS relies on writing your full RAM contents to swap on disk, having a fast, reliable SSD makes suspend-to-disk and resume feel snappy rather than sluggish. A dedicated SSD also gives you room to set up a proper swap partition, sidestepping some of the swapfile complications the article mentions. It's a solid upgrade for anyone tuning their Linux laptop's power management.
See Crucial MX500 1TB SATA SSD on Amazon → Affiliate link — we may earn a commission on purchases, at no extra cost to you. Product picked by AI based on this article; it is not a tested recommendation.Source: blog.matthewbrunelle.com, 2026-09-23
Published there as: “Swap, ZRAM, Zswap and Hibernate on NixOS”
Read the original report → The summary and analysis above are GoKawiil's own, written from reporting by the source above. Facts and quotes belong to the original publisher.