Lets create simple script:
#!/bin/bash
mypath=$1
while [[ "${#mypath}" -gt 1 ]]; do
file "$mypath"
mypath="$(dirname $mypath)"
done
Test:
$ ./linksinfo /usr/src/linux/kernel/../../../../bin/sh
/usr/src/linux/kernel/../../../../bin/sh: symbolic link to `bash'
/usr/src/linux/kernel/../../../../bin: directory
/usr/src/linux/kernel/../../../..: directory
/usr/src/linux/kernel/../../..: directory
/usr/src/linux/kernel/../..: directory
/usr/src/linux/kernel/..: directory
/usr/src/linux/kernel: directory
/usr/src/linux: symbolic link to `linux-3.14.14-gentoo'
/usr/src: directory
/usr: directory
Edit
This does not check/show all path components, but the output in you question doesn't do this either. For example after
/home/nix/.nix-profile -> /nix/var/nix/profiles/default
it is possible that any of /nix, /nix/var/, /nix/var/nix, /nix/var/nix/profiles or /nix/var/nix/profiles/default is a link itself. However your output skips this and checks only /nix/var/nix/profiles/default/lib. Similar thing happens with
/nix/var/nix/profiles/default/lib/libQt5OpenGL.so -> /nix/store/33xkmx1f1040s5nb15x7hx2cqmyw1jyi-qt-5.3.1/lib/libQt5OpenGL.so
Again the output says nothing about /nix/store and /nix/store/33xkmx1f1040s5nb15x7hx2cqmyw1jyi-qt-5.3.1. Long story short I suggest to reconsider the problem and think what you really want to achieve. Perhaps simple readlink [-f] or realpath [-e] is enough?