my SSH on the server becomes unresponsive when it tries to compile some things. I think it’s because I only have 1gb of RAM and it gets flooded with the compilation.
You can also try installing the packages telegram-api and http-client separately or even install dependencies of those packages separately first. For example, servant, which is a dependency of telegram-api, is already a large package and could be installed separately before installing telegram-api.
This may sound a bit radical but you could try to employ Nix. It will just download all binary packages needed. In a sense, you would trade RAM for disk space as Nix will fetch a lot of stuff along the way.