Swap

From NixOS Wiki
Revision as of 17:14, 8 July 2021 by imported>Yuu

Configuration

Swap on NixOS is set with the option swapDevices on /etc/nixos/hardware-configuration.nix.

Disable swap

To remove all swap devices from NixOS, set

swapDevices = lib.mkForce [ ];

This will remove the swap partition or file from being included in /etc/fstab.

If you are using GPT partitioning tables, systemd-gpt-auto-generator(8) will still mount your swap partition automatically. You must therefore turn on attribute 63 on your partition in the partition table. This can be done with gptfdisk or similar:

gdisk /dev/sda
x
a
<partition number>
63
<enter>
w