I posted Why isn't deriver and realize identity functions (see example) which is maybe related.
This UX is terrible for anyone trying to understand Nix.
> which htop
/Users/fzakaria/.nix-profile/bin/htop
> nix derivation show $(which htop) | jq -r "keys[0]"
/nix/store/hgnz7dz10vi0n81s341iihqm1azq4lb6-htop-3.2.2.drv
> nix-store --query --deriver $(which htop)
/nix/store/nshxi52ldsv03sc8k810kw5j3hwa69bv-htop-3.2.2.drv
Those two derivations are different and only one exists on my system.