nix/install: Rewrite to not rely on bashisms.

Gets rid of `[[ ... ]]` and provides a fallback to `which` if the `type` builtin is not available.

This now longer relies on "set -e", because we're checking the errors carefully by ourselves and properly clean up whenever there was an error.

Also, we no longer download into a temporary file but download, decompress and extract on the fly. The main reason for this is because older tar versions don't either detect the compression type or even do not have `-j` at all.