Refactor environment setup into separate file

It is now possible to refer to files in priv directories as usual with
code:priv_dir(App). It is also possible to pass custom emulator args to
the escript creation.