Generate environment variables from links.

Fixes #91.
And note that they use ADDR rather than HOST, so we need to discuss whether hostnames should be resolved before the environment variables are generated. Similar to #322