nerves-env: add check that script is being sourced

Also add better error messages.