[install script] Refactors NVM_DIR

After the PR:
* Uses a function to define the install dir (aka `NVM_DIR`)
* Does not replace an empty yet defined `NVM_DIR` variable, but uses a default value instead
* `NVM_DIR` is used at a single point in the install script

This syntax hasn't been previously used in `nvm` - can you confirm that it's portable, and will work in all supported shells? Brief experimentation suggests that it will, but there must be a reason it's never been used previously if so.