`Nix-shell -p 'python37.pkgs.pytest'` fails

Ok, thanks a lot. Is there a way I should have known that? As a new user I thought that all packages available in <nixpkgs> are maintained until removed.

But your answer let me to this find nixpkgs commit-id for a package.

So searching for python3, shows that I can do

nix-shell -p 'python37.withPackages(ps: with ps; [pytest])' -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/20dd1e678299aae83735f1af5d1dcd80de22da5f.tar.gz

Btw, what is the equivalent nix ... command? Is it correct that I should get familiar with nix shell ... -c $SHELL instead of nix-shell -p?