← All stories
● Covered by 1 source · 1 reportLow impact1 neutral

Configuring Swap, ZRAM, Zswap, and Hibernate on NixOS for Desktops and Laptops

🔄 Updated 6h ago
New to BrevFeed? We gather this story from every outlet covering it into one summary — ranked by real-world impact, not just the latest headline — so you never miss what matters. What is BrevFeed? →

Key points

  • Swap is required for hibernation functionality.
  • NixOS supports hibernation with both swap partitions and swap files.
  • The recommended configuration uses zswap with disk-backed swap.
  • A 'swappiness' value of 100 is suggested for optimal performance on some systems.

Swap for Hibernation

The article focuses on configuring swap for desktop and laptop environments, particularly for enabling suspend-then-hibernate functionality. This feature first suspends to RAM (ACPI S3) and then transitions to hibernate (S4) after a delay, requiring swap space to save the system state to disk.

Swap File vs. Swap Partition

The discussion covers both swap files and swap partitions. While swap files can complicate hibernation due to the need for initramfs to locate swap space before filesystems are mounted, NixOS can handle the nuances of hibernation with swap files, including figuring out offsets. Examples of both swap partition and swap file configurations on NixOS are provided.

Recommended Configuration with Zswap

The current recommended configuration involves enabling zswap alongside disk-backed swap. This setup is based on recommendations for optimizing swap usage. The configuration is concise, requiring only a few lines in the NixOS configuration.

Swappiness Value

The article suggests setting the 'vm.swappiness' kernel parameter to 100. This value controls the relative cost of swapping versus filesystem paging and is recommended for certain hardware configurations to achieve optimal performance.

✨ This summary was generated by AI from the outlets' reporting listed below. It is not independently verified and may contain errors — check the original sources. How BrevFeed works →

The daily brief

One email each morning: the day's tech stories, clustered across outlets and summarized. No account needed.

One email a day. Unsubscribe in one click, any time.

Today's brief

Spend a few minutes, get the whole day. Every topic's top stories in one hands-free rundown — listen, watch, or read the transcript.

~26 min · 21 stories · Sep 23

▶ Play today's brief Listen on Spotify

New every morning, and the back catalogue is archived by date.

Reporting from

This article details how to configure swap, zram, zswap, and hibernate features on NixOS, specifically for desktop and laptop use cases. It explains the necessity of swap for hibernation and discusses the differences between swap partitions and swap files, noting NixOS's handling of swap files for hibernation.