How to add a swap after NixOs installation

I think the easiest thing for you to do now would be to create a swapfile:

{
  swapDevices = [{
    device = "/swapfile";
    size = 16 * 1024; # 16GB
  }];
}

Just switch configurations and it should be created automatically.

2 Likes