swapDevices nixos module vs disko swap module: what's the difference, and which to use?

Yes, exactly. Disko is about partitioning your disk (hence the name). It won’t create files for you.

If you want to use swap files, use the NixOS option. I would advise against using swapfiles, though, especially if you’re using btrfs:

See this summary in the thread in question on how to set up a swap file, too, but again, don’t actually do this. I’m pretty sure it will mess up your filesystem by default on btrfs.

For swap partitions configured with disko, like this.

If you want to change the encryption options, looks like for the time being you’ll have to manually set them in your NixOS configuration instead of through disko. Thanks to the NixOS module system multiple definitions of the same device will be merged constructively, so you can just redefine it and only set the encryption options.

1 Like