I wish #nix #nixpkgs had built in hints in the files that indicated a minimum amount of memory to build a package; so could warn you and abort if you likely don't have enough memory to build it, or if you have multiple machines doing builds, it could keep track of the memory load vs required memory of each build and assign based on that, because a build hitting swap is a build that runs like shit.
