NixOS/nixpkgs — pull request #2543 by wizeman (2014-05-06 18:17:48+00:00)
Title: nixos: Add zram swap module

This allows you to use the Linux kernel's built-in compressed memory as
swap space functionality.

It is recommended to enable only for kernel 3.14 (which is when zram came out of
the staging drivers area) or higher.
===============
Please note that there seems to be a bug either in my service or in systemd where, if you have this service enabled but then reduce the value of numDevices and do a "nixos-rebuild switch", then the swap systemd units which should disappear do not actually disappear but remain in a failed state instead (until you reboot).

Even more worrying is that (if I'm remembering correctly) when transitioning to the new configuration during nixos-rebuild switch, systemd won't actually disable/swapoff these swap units, but the zram devices which the swap units depend on will still be disabled/deactivated. This may or may not cause the system to crash, I'm not sure...

It would be really helpful if someone who knows how systemd works better than me would comment on how come systemd won't disable swap units when transitioning to a new configuration... could this be a bug in switch-to-configuration.pl, perhaps?