Swap: Difference between revisions
imported>Zarelit Add "size" parameter unit of measure and pointer to nixos option |
Add section about zram as an option for swap on nixos |
||
| Line 2: | Line 2: | ||
== Configuration == | == Configuration == | ||
Swap on NixOS is set with | Swap on NixOS is set with with one of two options <code>swapDevices</code> or <code>zramSwap.enable</code> on <code>/etc/nixos/hardware-configuration.nix</code>. | ||
=== Add a Swapfile === | === Add a Swapfile === | ||
| Line 35: | Line 35: | ||
w | w | ||
</syntaxhighlight> | </syntaxhighlight> | ||
=== Enable zram swap === | |||
Zram is a kernel module for creating a compressed block device in RAM. The option <code>zramSwap.enable</code> creates such a zram block device and uses it as swap device. | |||
It is an alternative or complementary approach to swap disks, suitable for systems with enough RAM. In the event the system needs to swap it will move uncompressed RAM contents into the compressed area, saving RAM space while effectively increasing the available RAM at the cost of computational power for compression and decompression. | |||
=== Encrypt swap with random key === | === Encrypt swap with random key === | ||